Commit Graph

274 Commits

Author SHA1 Message Date
Kacper Donat
4aabd47dcd Gui: Trim tree view column only if one column 2024-07-27 20:29:42 +02:00
PaddleStroke
4769926120 Core: Tree: add canDragFromParents to reduce code duplicity. + Few small fixes 2024-07-15 17:53:02 +02:00
PaddleStroke
e6fb9f0185 Assembly: Use canDragObjectToTarget in viewProviderAssembly 2024-07-15 17:53:02 +02:00
PaddleStroke
e71351cf7d Core: Tree / ViewProvider : Add canDragObjectToTarget 2024-07-15 17:53:02 +02:00
PaddleStroke
febe4dbd8c Core: Tree.cpp: few syntax fixes 2024-07-15 17:53:02 +02:00
Max Wilfinger
8ff5a1f688 Fix source string typos mentioned on Crowdin (#15261) 2024-07-08 17:18:31 -05:00
Roy-043
c596c8e17c Gui: Tree.cpp make some gui texts more consistent
The gui texts for "Show description" and "Show internal name" were inconsistent.

"Show description column" -> "Show description"

"Show an extra tree view column for item description. -> "Show a description column for items."
2024-06-24 11:29:05 -05:00
PaddleStroke
d8db937901 Core: Tree: Remove !vp->canDragAndDropObject(obj) that made no sense. And remove the auto switching to 'CopyAction' 2024-06-24 10:42:49 -05:00
Chris Hennes
f11af4f2a5 Gui: Silence unused variable 2024-06-22 08:29:27 +02:00
wmayer
127f935711 Fix several compiler warnings
* -Wmaybe-uninitialized
* -Wunused-parameter
* -Wunused-variable
* -Wnonnull
* -Wstringop-truncation
* -Wstringop-overflow
2024-06-19 21:14:23 -05:00
Chris Hennes
587cd884e8 Merge pull request #14388 from Ondsel-Development/core_rootObjects
Core: Add Gui::Document::getTreeRootObjects() Fixes #14373
2024-06-17 11:04:18 -05:00
Chris Hennes
f82ba8b47e Merge pull request #14393 from NomAnor/visibility-icon
Change visibility icon default to enabled and tweak visuals
2024-06-17 10:36:35 -05:00
PaddleStroke
fb32579498 Core: Add Gui::Document::getTreeRootObjects() 2024-06-12 10:57:24 +02:00
Kuzemko Alexsandr
4d5eb39762 Displaying internal names in the tree view (#14237)
* Displaying internal names in the tree view

* Change "Hide extra column" to "Hide Description"

---------

Co-authored-by: Kuzma30 <kuzemkoa@gmail.com>
2024-06-10 11:31:04 -05:00
wmayer
511e1198f6 Fix compiler warnings 2024-06-04 17:36:10 +02:00
Kacper Donat
b7ff904144 Gui: Fix document tree background rendering with overlay (Qt6)
This aims to fix rendering of tree view items in Qt6. While I don't
belive that this is a good way to fix this, I am worried that it is the
only way to do ir.

BC BREAK: This change introduces artificial QTreeView widget that can be
targeted using QSS and can be used in the delegate for painting background of
items. `QTreeView::item` would now be used to render background for the
whole row, while each cell can be targeted using `#DocumentTreeItems`
selector.

More details on implementation:
https://stackoverflow.com/questions/78414383/qt6-disable-drawing-of-default-background-for-qtreeview-items/78421604#78421604

Fixes: #13760
2024-06-03 11:28:02 -05:00
André Althaus
60ec5db4b3 Fix visibility icon for link elements
The visibility of link elements must be set with setElementVisible.
This will first try to use that API otherwise it falls back to setting
the Visibility property.
2024-06-03 11:12:57 -05:00
André Althaus
198c29b816 Gray out hidden items regardless of the visibility icon setting 2024-06-02 14:22:45 +02:00
André Althaus
9c9f1b0a5d Increase space between visibility icon and normal icon
Adds PM_LayoutHorizontalSpacing betweenthe visibility icon and the normal icon.
2024-06-02 14:22:41 +02:00
André Althaus
f733c87902 Account for margin in visibility icon click check 2024-06-02 14:22:09 +02:00
mos
a8d093280e [gui] code clean
.
2024-05-23 11:34:15 +02:00
André Althaus
fb4fe28c39 Gray out all columns in the tree if an item is invisible 2024-05-20 11:04:45 -05:00
PaddleStroke
5f4dd814ea Core: Add getRootObjectsIgnoreLinks and fix bugs in tree.cpp and AssemblyObject.cpp, CommandInsertLink.py, UtilsAssembly.py 2024-05-13 17:58:34 +02:00
Florian Foinant-Willig
1398ab67e4 Fix #13107 (#13682)
Introduce a signal slot for tree item highlight change.
2024-05-13 10:42:57 -05:00
wmayer
a2037c9dc4 Gui: Replace TreeRank property with a simple int
This fixes that copied & pasted objects are not added at the end of the tree view.
See https://forum.freecad.org/viewtopic.php?p=755532#p755532
2024-05-06 18:24:20 +02:00
wmayer
7eeb3a43cc Gui: Do not reset placement when reordering top-level objects
This fixes #13690: Reordering top level objects destroys the Placement
2024-05-06 18:24:20 +02:00
wmayer
d37fb29b36 Gui: fix some linter warnings 2024-05-06 18:24:20 +02:00
farley
8f7424820c Update Tree.cpp
- Disable document activation when right-clicking
2024-05-06 17:57:15 +02:00
wmayer
34837d7e9f PD: Fix crash when adding sketch to loft via tree view
The underlying problem is the method DocumentItem::updateItemSelection() where
the selection is altered. This may cause the destruction and recreation of the
DocumentObjectItems so that the passed pointer can become dangling.

The issue is fixed in two steps:
1. Add the method 'DocumentObjectItem *findItem(App::DocumentObject* obj, const std::string& subname) const'
   to safely re-access the item.
2. Add a boolean flag 'dirtyFlag' and the methods insertItem() and removeItem() to DocumentObjectData.
   This is needed to check when the iterator over the container becomes invalid.
2024-05-06 17:38:59 +02:00
wmayer
098d42573b Gui: fix computing status value and use enum to avoid magic numbers 2024-03-31 10:59:00 +02:00
ppphp
8863b9ac4c fix: c++20 deprecate [=] 2024-03-31 10:47:32 +02:00
Max Wilfinger
e38b8d9bd4 update hardcoded XPMs to .svg files. Updated .svg icons for clarity. 2024-03-30 11:25:13 +01:00
luzpaz
65cdbe3e89 Fix various typos throughout the codebase (#13029)
* Fix various typos throughout the codebase

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

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

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2024-03-18 16:54:30 -05:00
André Althaus
570c2b121f Fix #12780: An additional visibility icon is shown for features in groups
The icons in the testStatus() function are taken by reference and modified
inside. This seems to be used for caching when the same item occurs
multiple times in the tree. This can be the case for groups.

The visibility icon was added without taking the cached icon into
consideration and so it was added a second time.
The code is now moved into the if statement checking for this case.
2024-03-11 12:23:04 -05:00
Florian Foinant-Willig
c53d5fbf9d Introduce object freeze (#12580)
* Introduce object freeze

* do nothing at property change
2024-03-04 17:54:25 +01:00
PaddleStroke
4d35f0b2a2 Remove warning in Tree.cpp from 12293 2024-02-27 10:22:30 +01:00
Chris Hennes
afff892b14 Merge pull request #12412 from FlachyJoe/suppressibleExt
Core: Create a SuppressibleExtension to provide the Suppressed property to all the WBs
2024-02-26 10:53:46 -06:00
Chris Hennes
c566498d8f Merge pull request #12298 from NomAnor/visibility-icon
Add an icon to toggle the visibility of items in the tree view
2024-02-26 10:45:07 -06:00
PaddleStroke
fec1a86e30 Core: Tree: Allow reordering in root and groups allowing it (parts, groups 2024-02-26 10:42:21 -06:00
André Althaus
8ed244df3f Add a new preference for the visibility icons
Add a preference to Display->UI that allows the user to choose if
the visibility icons are shown in the tree view.
2024-02-21 19:28:28 +01:00
André Althaus
65cb454559 Add a function to recalculate the icons for use when the visibility icon preference changes 2024-02-21 19:25:13 +01:00
André Althaus
d0c3b0d01a Toggle visibility when clicking the visibility icon
If the visibility icon is enabled a mouse press on that part of the icon
toggles the visibility of the tree item.
2024-02-21 19:25:13 +01:00
André Althaus
00ed73b909 Add visibility icon
Prepends the visibility icon to the normal icon if enabled and uses
the result as the new icon.
2024-02-21 19:25:12 +01:00
Florian Foinant-Willig
5d539cd940 Add SuppressibleExtension 2024-02-21 16:19:32 +01:00
Paddle
8889cc1163 Core: tree: prevent object replacement when dragging 2024-01-22 10:53:47 -06:00
Paddle
f7798327cf Core: PropertyEditor : save properly the size of the first column. 2024-01-19 10:49:33 +01:00
Paddle
21905c0d62 Core: add property command, that shows property view. 2024-01-19 10:26:00 +01:00
Paddle
56bf4e7ebd Core : Tree: Add 'Properties' action in contextual menu. Opens a property dialog. 2024-01-17 17:00:55 +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
91aa75fb18 Gui: fix some important linting warnings:
* cppcoreguidelines-explicit-virtual-functions
* google-explicit-constructor
2023-10-12 11:48:16 +02:00