[Core] Add visibility toggling to ViewProvider

With this extension of the API, view providers can indicate whether
document objects should be able to be toggled for visibility.  There is
both a C++ and Python interface, idiomatic for FreeCAD code.
This commit is contained in:
Pieter Hijma
2025-04-05 13:47:00 +02:00
parent 62b0e6eb4f
commit 0d5481e448
6 changed files with 78 additions and 2 deletions

View File

@@ -5534,7 +5534,9 @@ void DocumentObjectItem::testStatus(bool resetStatus, QIcon& icon1, QIcon& icon2
QPainter pt;
pt.begin(&px);
pt.setPen(Qt::NoPen);
pt.drawPixmap(0, 0, px_org.width(), px_org.height(), (currentStatus & Status::Visible) ? pxVisible : pxInvisible);
if (object()->canToggleVisibility()) {
pt.drawPixmap(0, 0, px_org.width(), px_org.height(), (currentStatus & Status::Visible) ? pxVisible : pxInvisible);
}
pt.drawPixmap(px_org.width() + spacing, 0, px_org.width(), px_org.height(), px_org);
pt.end();