diff --git a/src/Gui/Icons/TreeItemInvisible.svg b/src/Gui/Icons/TreeItemInvisible.svg index 69b78db09a..fc8c703321 100644 --- a/src/Gui/Icons/TreeItemInvisible.svg +++ b/src/Gui/Icons/TreeItemInvisible.svg @@ -2,20 +2,20 @@ + inkscape:version="1.3.2 (091e20ef0f, 2023-11-25, custom)" + sodipodi:docname="TreeItemInvisible.svg" + xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" + xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" + xmlns:xlink="http://www.w3.org/1999/xlink" + xmlns="http://www.w3.org/2000/svg" + xmlns:svg="http://www.w3.org/2000/svg" + xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" + xmlns:cc="http://creativecommons.org/ns#" + xmlns:dc="http://purl.org/dc/elements/1.1/"> + inkscape:snap-global="true" + inkscape:showpageshadow="2" + inkscape:pagecheckerboard="0" + inkscape:deskcolor="#d1d1d1"> + snapvisiblegridlinesonly="true" + originx="0" + originy="0" + spacingy="1" + spacingx="1" + units="px" /> @@ -587,7 +595,7 @@ style="opacity:0.8479996;fill:#ffffff;stroke:none;stroke-width:0.18025407;stroke-opacity:1" /> style(); + // If the checkboxes are visible, these are displayed before the icon // and we have to compensate for its width. if (isSelectionCheckBoxesEnabled()) { - auto style = this->style(); int checkboxWidth = style->pixelMetric(QStyle::PM_IndicatorWidth) + style->pixelMetric(QStyle::PM_LayoutHorizontalSpacing); iconRect.adjust(checkboxWidth, 0, 0, 0); } + int const margin = style->pixelMetric(QStyle::PM_FocusFrameHMargin) + 1; + iconRect.adjust(margin, 0, 0, 0); + // We are interested in the first icon (visibility icon) iconRect.setWidth(iconSize()); @@ -5308,7 +5312,7 @@ void DocumentObjectItem::testStatus(bool resetStatus, QIcon& icon1, QIcon& icon2 previousStatus = currentStatus; QIcon::Mode mode = QIcon::Normal; - if (isVisibilityIconEnabled() || (currentStatus & Status::Visible)) { + if (currentStatus & Status::Visible) { // Note: By default the foreground, i.e. text color is invalid // to make use of the default color of the tree widget's palette. // If we temporarily set this color to dark and reset to an invalid @@ -5426,17 +5430,19 @@ void DocumentObjectItem::testStatus(bool resetStatus, QIcon& icon1, QIcon& icon2 // Prepend the visibility pixmap to the final icon pixmaps and use these as the icon. QIcon new_icon; + auto style = this->getTree()->style(); + int const spacing = style->pixelMetric(QStyle::PM_LayoutHorizontalSpacing); for (auto state: {QIcon::On, QIcon::Off}) { QPixmap px_org = icon.pixmap(0xFFFF, 0xFFFF, QIcon::Normal, state); - QPixmap px(2*px_org.width(), px_org.height()); + QPixmap px(2*px_org.width() + spacing, px_org.height()); px.fill(Qt::transparent); QPainter pt; pt.begin(&px); pt.setPen(Qt::NoPen); pt.drawPixmap(0, 0, px_org.width(), px_org.height(), (currentStatus & Status::Visible) ? pxVisible : pxInvisible); - pt.drawPixmap(px_org.width(), 0, px_org.width(), px_org.height(), px_org); + pt.drawPixmap(px_org.width() + spacing, 0, px_org.width(), px_org.height(), px_org); pt.end(); new_icon.addPixmap(px, QIcon::Normal, state); diff --git a/src/Gui/TreeParams.cpp b/src/Gui/TreeParams.cpp index faede3d53b..50d7c0a110 100644 --- a/src/Gui/TreeParams.cpp +++ b/src/Gui/TreeParams.cpp @@ -163,7 +163,7 @@ public: funcs["ColumnSize3"] = &TreeParamsP::updateColumnSize3; TreeToolTipIcon = handle->GetBool("TreeToolTipIcon", false); funcs["TreeToolTipIcon"] = &TreeParamsP::updateTreeToolTipIcon; - VisibilityIcon = handle->GetBool("VisibilityIcon", false); + VisibilityIcon = handle->GetBool("VisibilityIcon", true); funcs["VisibilityIcon"] = &TreeParamsP::updateVisibilityIcon; } @@ -413,7 +413,7 @@ public: } // Auto generated code (Tools/params_utils.py:296) static void updateVisibilityIcon(TreeParamsP *self) { - auto v = self->handle->GetBool("VisibilityIcon", false); + auto v = self->handle->GetBool("VisibilityIcon", true); if (self->VisibilityIcon != v) { self->VisibilityIcon = v; TreeParams::onVisibilityIconChanged(); @@ -1480,7 +1480,7 @@ const bool & TreeParams::getVisibilityIcon() { // Auto generated code (Tools/params_utils.py:366) const bool & TreeParams::defaultVisibilityIcon() { - const static bool def = false; + const static bool def = true; return def; } diff --git a/src/Gui/TreeParams.py b/src/Gui/TreeParams.py index aa072e1566..8c06880cab 100644 --- a/src/Gui/TreeParams.py +++ b/src/Gui/TreeParams.py @@ -83,7 +83,7 @@ Params = [ ParamInt('ColumnSize2', 0), ParamInt('ColumnSize3', 0), ParamBool('TreeToolTipIcon', False, title='Show icon in tool tip'), - ParamBool('VisibilityIcon', False, on_change=True, title='Show visibility icon', + ParamBool('VisibilityIcon', True, on_change=True, title='Show visibility icon', doc = "If enabled, show an eye icon before the tree view items, showing the items visibility status. When clicked the visibility is toggled"), ]