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
ColorRampComboBox Class Reference

#include <colorrampcombobox.h>

Inheritance diagram for ColorRampComboBox:
Collaboration diagram for ColorRampComboBox:

Signals

void rampChanged (const RasterColorRamp &ramp)
 
void customRampSaved (const QString &name, const RasterColorRamp &ramp)
 

Public Member Functions

 ColorRampComboBox (QWidget *parent=nullptr)
 
 ~ColorRampComboBox () override
 
RasterColorRamp currentRamp () const
 
bool currentIsCustom () const
 
void setCurrentRampByName (const QString &name)
 
void ensureRampSelected (const QString &name, const RasterColorRamp &ramp)
 
void rebuildItems ()
 

Protected Member Functions

void paintEvent (QPaintEvent *event) override
 

Constructor & Destructor Documentation

◆ ColorRampComboBox()

ColorRampComboBox::ColorRampComboBox ( QWidget *  parent = nullptr)
explicit
Here is the call graph for this function:

◆ ~ColorRampComboBox()

ColorRampComboBox::~ColorRampComboBox ( )
overridedefault

Member Function Documentation

◆ currentIsCustom()

bool ColorRampComboBox::currentIsCustom ( ) const

True when the current selection is a user-authored (custom) ramp rather than a built-in. Consumers that persist ramps by NAME must check this and store the full payload instead — builtin-name lookup degrades unknown names to grayscale.

◆ currentRamp()

RasterColorRamp ColorRampComboBox::currentRamp ( ) const

Currently-selected ramp (built-in or user-custom). Returns RasterColorRamp::grayscale() when the "Edit Custom Ramp…" sentinel row is the active selection.

Here is the call graph for this function:

◆ customRampSaved

void ColorRampComboBox::customRampSaved ( const QString &  name,
const RasterColorRamp ramp 
)
signal

Emitted after the user saves a new ramp from the editor dialog (Edit Custom Ramp…). The new ramp is appended to the combo and also persisted to PreferencesManager.

◆ ensureRampSelected()

void ColorRampComboBox::ensureRampSelected ( const QString &  name,
const RasterColorRamp ramp 
)

Select the ramp named name; when no row carries that name (a custom ramp authored on another machine, or one since deleted from the preferences library) a transient "custom" row is inserted from the supplied payload so the swatch and selection stay truthful.

Here is the caller graph for this function:

◆ paintEvent()

void ColorRampComboBox::paintEvent ( QPaintEvent *  event)
overrideprotected

Slice S4 — override the QComboBox default text-only closed state so the gradient swatch keeps rendering after selection. QGIS / ArcGIS Pro idiom.

◆ rampChanged

void ColorRampComboBox::rampChanged ( const RasterColorRamp ramp)
signal

Emitted whenever the user picks a ramp from the dropdown. Not emitted for the "Edit Custom Ramp…" sentinel — for that case customRampSaved fires after the editor dialog returns.

◆ rebuildItems()

void ColorRampComboBox::rebuildItems ( )

Pre-populates the combo with built-ins. Custom user ramps loaded from PreferencesManager::customColorRamps() are appended below a separator.

Here is the caller graph for this function:

◆ setCurrentRampByName()

void ColorRampComboBox::setCurrentRampByName ( const QString &  name)

Selects the first item whose ramp matches name (case-insensitive, matched against built-in display names and against user-ramp labels). No-op when no item matches.

Here is the caller graph for this function:

The documentation for this class was generated from the following files: