SWMMVis  6.0.0-alpha.4
Qt6/C++ GIS-based graphical user interface for the SWMMVis engine (6.0.0-alpha.4)
Loading...
Searching...
No Matches
legendoverlay.h File Reference

On-canvas, draggable legend painted in widget pixel coords. More...

#include <QPoint>
#include <QPointer>
#include <QRect>
#include <QSize>
#include <QVector>
#include <QWidget>
Include dependency graph for legendoverlay.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

class  openswmmvis::ui::LegendOverlay
 

Namespaces

namespace  OpenSWMM
 
namespace  OpenSWMM::Render
 
namespace  openswmmvis
 
namespace  openswmmvis::ui
 

Detailed Description

On-canvas, draggable legend painted in widget pixel coords.

Author
Caleb Buahin caleb.nosp@m..bua.nosp@m.hin@g.nosp@m.mail.nosp@m..com
Date
2026
License\n GPL-3.0-or-later
    LegendOverlay is a child QWidget of MapCanvas. It paints each
    visible layer's legendSymbolItems() (per the §J.5
    legend-from-renderer rule) into a translucent rounded box and
    lets the user drag it around with the mouse. The user-facing
    "Show Legend" toolbar toggle controls its visibility.

    Slice BB Phase 8.6.16 — interim wiring:
      - All chrome (fonts, frame, background, padding, anchor,
        opacity) is driven by a shared LegendOverlayStyle the
        overlay owns by default but can be re-pointed at a project-
        scoped instance once persistence lands (Phase 8.6.12).
      - Right-click opens a context-sensitive QMenu (Properties…,
        Hide Layer …, Copy Legend Image, Reset Layout, Hide Legend).

    The overlay subscribes to the bound MapCanvas's layerAdded /
    layerRemoved / layerOrderChanged signals plus each layer's
    visibilityChanged / nameChanged / repaintRequested so it
    stays in sync with the map without a polling loop. It also
    subscribes to LegendOverlayStyle::changed() so live edits from
    LegendPropertiesDialog repaint instantly.

    Position is stored in widget-pixel coordinates relative to
    the canvas. On canvas resize the overlay is clamped back into
    the visible rect so it never escapes off-screen.