Commit Graph

45 Commits

Author SHA1 Message Date
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
PaddleStroke
10a6a3fbe6 Sketcher: Fix #13927 (#22427) 2025-07-16 21:55:52 -05:00
Benjamin Nauck
df3c324b7d Gui: use contains() and isEmpty() instead of count() where possible 2025-05-03 22:19:51 +02:00
wmayer
77711e6459 Qt6: Several methods of QMouseEvent are deprecated since Qt 6.0 2024-09-11 16:33:19 +02:00
Kacper Donat
e04b28e66d Gui: Use our own ToolBar class in all places 2024-06-25 11:39:54 +02:00
Zheng, Lei
214322665b Gui: Add dragging support for custom ToolBarAreas
This adds dragging support for toolbars placed in custom toolbar areas.
It is achived by creating our own custom ToolBar class that handles
logic of providing custom gripper. This is required because Qt hides
gripper when toolbar is not direct child of the main window which cannot
be overriden. Custom class should allow us to create more capable
toolbars in the future so it should be great addition on its own.

Co-Authored-By: Kacper Donat <kacper@kadet.net>
2024-06-25 11:39:51 +02:00
wmayer
951ece6b4c Gui: Move ToolBarAreaWidget to its own files
Since ToolBarAreaWidget is not a private class any more move its declaration and definition to their own source files.
2024-06-18 18:42:18 -05:00
Kacper Donat
75fe4f60f6 Gui: Split declaration and definition of ToolBarAreaWidget
In order to support targeting ToolBarAreaWidgets via the QSS we need to
make it a proper QObject using Q_OBJECT macro, which must be placed in
header files.
2024-06-17 10:38:12 -05:00
Kacper Donat
132cad9058 Gui: Fix ToolBarManager review remarks 2024-05-20 11:12:38 -05:00
Johannes Wüller
33e91421b5 Fix backwards-compatible Qt6 warnings 2024-05-13 11:39:24 -05:00
Chris Hennes
6c4f76a8a5 Merge pull request #13721 from kadet1090/more-at-the-end
Gui: Move more button to the end WB TabBar
2024-05-13 11:12:26 -05:00
Zheng, Lei
4919afddad Gui: fix toolbar init state 2024-05-13 11:06:01 -05:00
Kacper Donat
90dc3e3370 Gui: Add our ToolBarArea enumeration
This refactors implementation of toolbars in menu / status bar a bit. It
introduces enum with all possible areas like it is in Qt that can be
later used to decide what to do based on toolbar placement.
2024-05-12 19:05:12 +02:00
wmayer
254d6ea3fd Core: Refactor several methods of ToolBarManager 2024-05-07 19:48:33 +02:00
wmayer
ef682370f9 Core: Fix linter warnings 2024-05-07 19:48:33 +02:00
wmayer
ac48d2bfb0 Core: Fix build failures and warnings 2024-05-07 19:48:33 +02:00
bgbsww
fd53ab3c9b Update ToolBarManager.cpp for QT 6.7
Replace obsoleted method call
2024-05-07 10:18:15 -05:00
Zheng Lei
b00a4384bf Gui: support toolbar drag and drop to status bar and menu bar (#13571)
* Gui: support toolbar drag and drop to status bar and menu bar

Closes FreeCAD/FreeCAD#12979

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Gui: improve toolbar handling in status and menu bar

* Gui: fix workbench tab bar orientation in status or menu bar

* Gui: remove workbench toolbar position settings

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2024-05-06 17:59:16 +02:00
Kacper Donat
afd72f3585 Gui: Add ability to easily lock Toolbars from UI
This adds the Std_ToggleToolBarLock action mentioned in #4992. It is
exposed in the context menu of toolbar and also in the view -> toolbars
app menu.
2023-12-01 12:13:43 +01:00
wmayer
888a33917d Gui: modernize C++: use equals default 2023-08-20 18:12:43 +02:00
Abdullah Tahiri
667095e856 Gui: Unavailable toolbars default to visible when made available
================================================================

https://github.com/FreeCAD/FreeCAD/issues/9208#issuecomment-1567469254

Issue:
- Unavailable toolbars default to not visible (as they are unavailable)
- However, when made available, they remain not visible. There may be
  cases when this is indeed the wanted behaviour, but they are not the
  ones we are facing.
- In the latter, the user expects the toolbars to show (and the
  configuration file to be saved with all toolbars showing.

Solution:
- Change the default behaviour of Unavailable toolbars when forcing
  them to be available, so that they are visible when made available.
- If then the case arises that we have toolbars where we would prefer
  then to be left not visible when making them available (so they are
  listed in the toolbar context menu to make them visible, but not
  visible per default), then we would need to create another toolbar
  policy class "UnavailableHidden".
- I chose not to add it directly (although it is straightforward) in
  fear that we will never need it, and it would make the code more
  complex to understand and thus maintain.
2023-05-30 16:37:53 +02:00
Abdullah Tahiri
554ede35d2 Sketcher/Gui: Extend toolbar framework and fix toolbar visibility not preserved
=================================================================================

fixes #9208

Essentially:
- The regular mechanism to save toolbar state when changing from one WB to another
is not designed to support changes within one WB (e.g. from edit mode and back).
- At creation time, toolbars can be initialised with default visible or default hidden
state. Additionally, there is third configuration "Unavailable", which refers to a
toolbar that is hidden, and the control to enable it is also hidden by default.
- The ToolBarManager is extended to enable to set the State of one or more toolbars.
- The State refers to changes to be effected on one or more toolbars by client code:
* ForceHidden allows to hide a toolbar and also hide its control (a toolbar not available
in a mode).
* ForceAvailable allows to make a toolbar available by making its control visible, the
toolbar itself is visible or not depending on user settings.
* RestoreDefault allows to bring the control visibility to the default of the toolbar, the
toolbar itself is visible or not depending on user settings.
* SaveState allows to store the current visibility state of a toolbar. It enables client
code to save the state when appropriate. It provides the only option for default "Unavailable"
toolbars, which are fully managed by client code. It provides additional flexibility to save
other toolbar visibility on request.

For the Sketcher this means:
- That edit mode toolbars are not shown outside edit mode.
- That edit mode toolbars and non-edit mode toolbars can be configured independently.
- that edit mode toolbars' state is saved when leaving edit mode if and only if, the
workbench that is selected when leaving edit mode is the Sketcher WB.
- it won't save the state if the user manually selected another WB and then left edit
mode (why? see limitation above).

Limitation:
- When switching to another WB while in edit mode, the other WB is activated before the
current WB (sketcher WB) is deactivated. This means that at sketcher level, the sketcher
has no chance to save states or do other tidy up actions before the tools of the other WB
are activated.
- This, however, is understood as not relevant enough as to warrant changing the mechanisms
in place.
2023-05-30 16:37:53 +02:00
wmayer
90c296af6b Sketcher: fix some lint warnings 2023-04-03 17:36:06 +02:00
wmayer
c38ef7da53 Sketcher: ignore toolbars if toggle action is invisible or style is FORCE_HIDE
This fully fixes #9135
2023-04-03 17:36:06 +02:00
wmayer
6ee8ee3c73 Gui: [skip ci] fix whitespaces 2023-03-13 22:38:54 +01:00
Syres916
223f0b4b35 [Gui] Add TODO reference hack 2023-03-13 22:34:58 +01:00
Syres916
7e57d539ff [Gui] Improve comments regarding move of widget 2023-03-13 22:34:58 +01:00
Syres916
5e6cd8d51f [Gui] Fix regressions from PR7771...
specifically c24a50f486 fixes #7965 #8440
2023-03-13 22:34:58 +01:00
wmayer
be7e78aaf9 Gui: fix regression with the default visibility of toolbars
If the user e.g. activates the Clipboard toolbar then it should not be hidden any more if the user switches to another workbench.
The way it is now the user has to make this toolbar visible over and over again when changing the workbench. This also has the negative effect that
the workbench selector changes its position
2023-03-07 10:43:12 +01:00
Adrian Insaurralde Avalos
8200cde106 [Gui] ToolBarManager: add feature to make toolbars hidden by default 2023-03-03 22:47:11 -06:00
wmayer
07224605dc Gui: use new-style connect and add curly braces to improve readability 2022-11-10 23:20:18 +01:00
Zheng, Lei
ae8ba0de3d Gui: fix shortcut context handling in ShortcutManager
Related #6097

Qt ignores shortcut of actions in invisible toolbar, but not for actions
in a hidden menu action of menu bar, which is likely a Qt bug. The
desired behavior should be that of toolbar actions, so that actions
belong to different workbenches can have the same shortcut without
conflict.

This commit works around this inconsistency by ensuring only the active
actions are added in menu bar. In addition, all active actions will be
added to a zero sized child widget of the main window, which ensures the
shortcuts of these actions being active regardless whether the action is
in toolbar or menu bar, visible or not.
2022-11-10 23:20:18 +01:00
Paddle
67a513e101 Gui: Allow to hide toolbars that are not needed.
In particular this hides edit-mode sketcher toolbars when in non-edit-mode.
    And hides non-edit-mode toolbar when in edit-mode.
    It also hides the structure toolbar when in edit-mode (as it is completely deactivated)
2022-11-04 12:02:16 -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
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
9de55d010c [Gui] Tool* etc.:remove unused includes 2022-03-05 18:08:13 +01:00
Mark Ganson TheMarkster
07fe28cf6b [MainWindow] Add toolbar name as toolbar's tooltip (#5259)
* [MainWindow] Add toolbar name as toolbar's  tooltip

Co-authored-by: Uwe <donovaly@users.noreply.github.com>
2021-12-17 03:16:30 +01:00
Chris Hennes
1a8a23a6a6 [Gui] Add hidden pref to lock toolbars
When arranged vertically, the bar that allows the dragging of toolbars
can cause problems with the toolbar appearance. This adds a hidden
preference that controls whether the toolbars are movable.
2021-08-26 09:12:25 -05:00
luz.paz
424cd49398 Typos and whitespace fixes 2018-08-07 11:13:31 -04:00
wmayer
c997180a47 Qt4/Qt5 neutral changes:
+ remove QCoreApplication::UnicodeUTF8/QApplication::UnicodeUTF8
+ remove QCoreApplication::CodecForTr/QApplication::CodecForTr
2016-12-12 14:52:09 +01: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
wmayer
e320db2164 + proper encoding of custom toolbar names 2014-01-26 16:02:22 +01:00
wmayer
791aca3c2c + fix changing 3d view when switching from Complete workbench to any other workbench
git-svn-id: https://free-cad.svn.sourceforge.net/svnroot/free-cad/trunk@5335 e8eeb9e2-ec13-0410-a4a9-efa5cf37419d
2011-12-21 17:14:04 +00:00
wmayer
120ca87015 + unify DLL export defines to namespace names
git-svn-id: https://free-cad.svn.sourceforge.net/svnroot/free-cad/trunk@5000 e8eeb9e2-ec13-0410-a4a9-efa5cf37419d
2011-10-10 13:44:52 +00:00