Commit Graph

82 Commits

Author SHA1 Message Date
carlopav
01df25866c 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
44ce401a53 [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
b5a5a6cd70 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
81918da613 Gui: remove py2 code 2021-04-25 11:27:48 +02:00
wmayer
b7aee7bfa1 fixes #0003844: PVS: The pointer was not released in destructor. A memory leak is possible. 2021-04-21 21:46:14 +02:00
wmayer
4c6c1af016 Gui: fix Command::_invoke to avoid build failure 2021-03-29 11:06:16 +02:00
wmayer
b55cc8aec1 Gui: [skip ci] refactor Command::invoke 2021-03-28 20:04:31 +02:00
wmayer
ffb196b1b7 Gui: Running a command with Gui.runCommand() must always be considered as Gui command 2021-03-28 18:40:16 +02:00
Zheng, Lei
0e2ab08121 Gui: temporary fix of preference menu in macos
QAction defaults menu role to TextHeuristicRole, which causes qt to
guess the menu role based on action title. And titles start with
'Config', 'Options', 'Settings', etc. will be considered as preference
menu. It seems some non-english translation causes the wrong action be
chosen as preference, such as 'Treeview actions'.

This commit just applied a temporary fix to default to QAction::NoRole
for GroupCommand. If there is ever some GroupCommand need to be a
system menu item on macos, we could add some command bit flag for that
purpose.
2020-12-24 16:58:18 +01:00
luz paz
298c677873 Gui: Fix header uniformity, whitespace, and doxygen fixes 2020-11-26 10:14:56 +01:00
wmayer
6199fbb25e Base: [skip ci] Coverity: Uncaught exception 2020-09-14 18:34:25 +02:00
Zheng, Lei
2fbac59d4f App: record transaction on non DocumentObject
Related #0004265
2020-09-04 16:01:21 +02:00
wmayer
c535881459 Qt5: Replace deprecated functions of QString:
'QString& QString::vsprintf(const char*, __va_list_tag*)' is deprecated: Use vasprintf(), arg() or QTextStream instead [-Wdeprecated-declarations]
'QString& QString::sprintf(const char*, ...)' is deprecated: Use asprintf(), arg() or QTextStream instead [-Wdeprecated-declarations]
2020-06-12 17:51:33 +02:00
wmayer
c814eb1a50 Qt5: 'QString::null' is deprecated: use QString() [-Wdeprecated-declarations] 2020-06-12 17:51:33 +02:00
wmayer
f900bdf115 Gui: [skip ci] fixes #0004330: The Std_WhatsThis command does not work for 2 submenus of the View menu. 2020-04-30 14:53:37 +02:00
Zheng, Lei
845fa8471a Gui: add class GroupCommand help with grouped command
As an example usage, changed StdCmdTreeViewActions to be derived from
GroupCommand
2019-10-08 10:16:00 +02:00
Zheng, Lei
e97b89b4c7 Gui: output Cmt type macro line as comment in python console 2019-10-08 10:15:18 +02:00
luz.paz
7b7797f4f3 Fix various (doxy) typos and whitespace issues
Found via `codespell -q 3 -L aci,ake,aline,alle,alledges,alocation,als,ang,anid,ba,beginn,behaviour,bloaded,byteorder,calculater,cancelled,cancelling,cas,cascade,centimetre,childs,colour,colours,commen,currenty,dof,doubleclick,dum,eiter,elemente,feld,freez,hist,iff,indicies,initialisation,initialise,initialised,initialises,initialisiert,ist,kilometre,lod,mantatory,methode,metres,millimetre,modell,nd,noe,normale,normaly,nto,numer,oder,orgin,orginx,orginy,ot,pard,pres,programm,que,recurrance,rougly,seperator,serie,sinc,strack,substraction,te,thist,thru,tread,uint,unter,vertexes,wallthickness,whitespaces -S ./.git,*.po,*.ts,./ChangeLog.txt,./src/3rdParty,./src/Mod/Assembly/App/opendcm,./src/CXX,./src/zipios++,./src/Base/swig*,./src/Mod/Robot/App/kdl_cp,./src/Mod/Import/App/SCL,./src/WindowsInstaller,./src/Doc/FreeCAD.uml`
2019-10-03 07:57:13 +02:00
wmayer
b50b21576e core system
force strict ISO C++ (-Wpedantic)
TODO: still a lot of variadic macros are not valid ISO C++
2019-09-18 01:01:14 +02:00
Zheng, Lei
fd0f4f5654 Split App::AutoTransaction into its own file 2019-09-10 14:17:07 +02:00
wmayer
9c69c886a4 fix MSVC compiler warnings 2019-08-17 19:35:21 +02:00
Zheng, Lei
d0ca893b3e Command: disable auto transaction if triggering editing
Each command will create an App::AutoTransaction to auto create and
commit a transaction for proper undo/redo. But if the command starts
editing, the current transaction may be required to out live the current
command.

Note that the command can only detect editing if the code calls
Gui::Document::setEdit(). There are objects that starts editing by
calling its own ViewProvider::setEdit(), e.g. various TechDraw
ViewProviders. In this case, to avoid auto committing, one can call
App::Application::setActiveTransaction() with the second argument set to
true, or call App::AutoTransaction::setEnable(false).
2019-08-17 15:32:51 +02:00
Zheng, Lei
b1c0de8dae Gui: Command API changes
* invoke(), distinguish between command triggering source. Also add
  support of auto transaction using App::AutoTransaction. Now all
  command will support undo/redo by default.

* setupCheckable(), a helper function to Improve support of
  PythonGroupCommand

* getObjectCmd(), helper function to output Python command to refer to
  an object without ambiguity. Because with introduction of external
  linking, an object can no longer be safely referred through the
  current active document.

* Support auto MacroManager command logger. For commands that does not
  log any output to MacroManager, a log entry of 'Gui.runCommand()' will
  be auto generated.

* Support linked object in copyVisual()

* Modified do/runCommand() to print calling file and line number.

* Add various helper macros for run command involving a document or
  object.
2019-08-17 14:52:10 +02:00
wmayer
f160cc7854 PVS: V773 A memory leak is possible 2019-02-17 19:17:02 +01:00
Mateusz Skowroński
317bcd59c9 Use QString's multi-arg overload to save memory allocations. [-Wclazy-qstring-arg] Thanks Clazy! 2019-02-11 15:39:14 +01:00
wmayer
0c8da1c38a add an assert to several Command methods to be notified in debug mode if no active document exists 2018-10-31 11:21:33 +01:00
luz.paz
505488c4f9 Misc. typos
Found via `codespell`
2018-04-25 09:41:33 -03:00
looooo
75a98c9613 add Base::PyGILStateLocker in Gui::Command::getResources 2018-01-12 15:02:13 +01:00
wmayer
868d9cc6c2 improve whitespaces 2017-11-24 15:43:28 +01:00
luzpaz
0d1451f39d User-facing typo fixes
All user-facing strings that have double (consecutive) whitespace e.g. `\b  \b`have been removed. Inspired by the error message in https://forum.freecadweb.org/viewtopic.php?f=3&t=5899&p=200309#p200309
2017-11-21 17:21:23 -03:00
Markus Lampert
da57822615 Use command's tootltip as statustip if no statustip is specified. 2017-09-28 23:22:11 +02:00
wmayer
5d2b22ca28 improve whitespaces 2017-08-31 23:01:34 +02:00
triplus
2cd535e015 WhatsThis support for Python based commands
Enables What's This command for Python based FreeCAD commands.

Forum discussion:
https://forum.freecadweb.org/viewtopic.php?f=15&t=23865
2017-08-13 11:20:25 +02:00
wmayer
5f54fc0298 py3: fix several crashes 2017-06-04 11:12:53 +02:00
Yorik van Havre
aa3f9288d6 py3: Gui: files A-P ported to python3 2017-05-06 17:23:27 +02:00
wmayer
1673ab801e use specialized exception classes 2017-04-28 18:49:11 +02:00
wmayer
d2cb4e4af9 Qt4/Qt5 neutral changes:
+ remove QCoreApplication::UnicodeUTF8/QApplication::UnicodeUTF8
+ remove QCoreApplication::CodecForTr/QApplication::CodecForTr
2016-12-12 14:52:09 +01:00
wmayer
57e7d3ad61 Qt4/Qt5 neutral changes:
+ remove class DownloadDialog
+ remove class HelpView
+ remove class DlgTipOfTheDay
2016-12-12 14:35:52 +01:00
Yorik van Havre
af97583026 Doc: Fixes in doxygen docs for Draft,Arch, FEM 2016-11-17 17:04:09 -02:00
wmayer
ff1b9dde41 issue #0002687: zoomin/out during transform 2016-10-09 18:32:18 +02:00
wmayer
f19d424d8b fix -Wextra in FreeCADGui 2016-09-21 20:54:52 +02:00
wmayer
afa37847b5 remove Application::runPythonCode 2016-09-15 23:14:31 +02:00
wmayer
f44df3cdf0 do not use doCommand without using format string, add overloaded method of runCommand 2016-09-15 18:53:37 +02:00
wmayer
a12ecd49bd fix unicode <=> utf-8 conversion issue 2016-09-12 20:52:24 +02:00
wmayer
ef363f9390 split compound command in separate commands to make shortcus customizable 2016-09-10 14:47:01 +02:00
wmayer
13528b0aec fix more Coverity issues 2016-08-17 21:55:00 +02:00
wmayer
3c269f4ccd + use QString's vsprintf to avoid to truncate the output string 2016-06-04 10:37:08 +02:00
wmayer
d8430f191f + simplify fix to avoid memory leaks in keySequenceToAccel 2016-03-09 17:19:19 +01:00
Eivind Kvedalen
e940274146 Fixed leak. 2016-03-08 16:09:25 +01:00
Abdullah Tahiri
8a3958ced5 Gui: Extension of CommandMacro for system-wide macros
=====================================================

What?
Extension of the CommandMacro constructor to take an additional optional argument to indicate that the macro
is located in the system-wide directory, and shall be executed accordingly.
2016-01-11 19:25:53 +01:00