Fluent-Qt

Status & info

InfoBadge

A small badge that shows counts, icons, or attention dots.

Example

InfoBadge: Display modes

Usage

Display modes

Auto resolves to a dot, icon, or value based on the badge content.

#include <FluentQt/StatusInfo.h>
using namespace fluent::status_info;

auto* dotBadge = new InfoBadge(this);

auto* iconBadge = new InfoBadge(this);
iconBadge->setIconGlyph(Typography::Icons::Mail);

auto* valueBadge = new InfoBadge(this);
valueBadge->setValue(7);

auto* explicitDot = new InfoBadge(this);
explicitDot->setDisplayMode(InfoBadge::InfoBadgeDisplayMode::Dot);

fluent::status_info::InfoBadge

Inherits QWidget · FluentElement · QMLPlus

Compact Fluent badge for value, icon, status, or attention signals.

Constructors

Properties

int value

Numeric badge value shown when display mode resolves to Value.

Read value()Write setValue()Notify valueChanged()
QString iconGlyph

Icon glyph shown when display mode resolves to Icon.

Read iconGlyph()Write setIconGlyph()Notify iconGlyphChanged()
InfoBadgeDisplayMode displayMode

Content mode used to choose dot, icon, value, or automatic badge rendering.

Read displayMode()Write setDisplayMode()Notify displayModeChanged()
InfoBadgeStatus status

Semantic status used to choose visual treatment.

Read status()Write setStatus()Notify statusChanged()
qreal badgeOpacity

Opacity applied to the badge visual.

Read badgeOpacity()Write setBadgeOpacity()Notify badgeOpacityChanged()
QColor customBackgroundColor

Custom badge background color override.

Read customBackgroundColor()Write setCustomBackgroundColor()Notify customBackgroundColorChanged()
QColor customTextColor

Custom badge text color override.

Read customTextColor()Write setCustomTextColor()Notify customTextColorChanged()
Typography::FontRole valueFontRole

Typography role used by badge value text.

Read valueFontRole()Write setValueFontRole()Notify valueFontRoleChanged()
int beaconDiameter

Diameter of beacon-style badge visuals.

Read beaconDiameter()Write setBeaconDiameter()Notify beaconDiameterChanged()
int badgeHeight

Height of pill-style badge visuals.

Read badgeHeight()Write setBadgeHeight()Notify badgeHeightChanged()
int valueHorizontalPadding

Horizontal padding around badge value text.

Read valueHorizontalPadding()Write setValueHorizontalPadding()Notify valueHorizontalPaddingChanged()
int iconGlyphSize

Icon glyph size in pixels.

Read iconGlyphSize()Write setIconGlyphSize()Notify iconGlyphSizeChanged()
QString iconFontFamily

Iconfont family used for glyph rendering.

Read iconFontFamily()Write setIconFontFamily()Notify iconFontFamilyChanged()
int badgeBackgroundInset

Inset applied to badge background painting.

Read badgeBackgroundInset()Write setBadgeBackgroundInset()Notify badgeBackgroundInsetChanged()
QPoint contentOffset

Pixel offset applied to badge content drawing.

Read contentOffset()Write setContentOffset()Notify contentOffsetChanged()

Methods

int value() const

Numeric badge value shown when display mode resolves to Value.

void setValue(int value)

Numeric badge value shown when display mode resolves to Value.

QString iconGlyph() const

Icon glyph shown when display mode resolves to Icon.

void setIconGlyph(const QString& glyph)

Icon glyph shown when display mode resolves to Icon.

InfoBadgeDisplayMode displayMode() const

Content mode used to choose dot, icon, value, or automatic badge rendering.

void setDisplayMode(InfoBadgeDisplayMode mode)

Content mode used to choose dot, icon, value, or automatic badge rendering.

InfoBadgeStatus status() const

Semantic status used to choose visual treatment.

void setStatus(InfoBadgeStatus status)

Semantic status used to choose visual treatment.

qreal badgeOpacity() const

Opacity applied to the badge visual.

void setBadgeOpacity(qreal opacity)

Opacity applied to the badge visual.

QColor customBackgroundColor() const

Custom badge background color override.

void setCustomBackgroundColor(const QColor& color)

Custom badge background color override.

QColor customTextColor() const

Custom badge text color override.

void setCustomTextColor(const QColor& color)

Custom badge text color override.

Typography::FontRole valueFontRole() const

Typography role used by badge value text.

void setValueFontRole(Typography::FontRole role)

Typography role used by badge value text.

int beaconDiameter() const

Diameter of beacon-style badge visuals.

void setBeaconDiameter(int diameter)

Diameter of beacon-style badge visuals.

int badgeHeight() const

Height of pill-style badge visuals.

void setBadgeHeight(int height)

Height of pill-style badge visuals.

int valueHorizontalPadding() const

Horizontal padding around badge value text.

void setValueHorizontalPadding(int padding)

Horizontal padding around badge value text.

int iconGlyphSize() const

Icon glyph size in pixels.

void setIconGlyphSize(int size)

Icon glyph size in pixels.

QString iconFontFamily() const

Iconfont family used for glyph rendering.

void setIconFontFamily(const QString& family)

Iconfont family used for glyph rendering.

int badgeBackgroundInset() const

Inset applied to badge background painting.

void setBadgeBackgroundInset(int inset)

Inset applied to badge background painting.

QPoint contentOffset() const

Pixel offset applied to badge content drawing.

void setContentOffset(const QPoint& offset)

Pixel offset applied to badge content drawing.

Signals

void valueChanged(int value)

Numeric badge value shown when display mode resolves to Value.

void iconGlyphChanged(const QString& glyph)

Icon glyph shown when display mode resolves to Icon.

void displayModeChanged(InfoBadgeDisplayMode mode)

Content mode used to choose dot, icon, value, or automatic badge rendering.

void statusChanged(InfoBadgeStatus status)

Semantic status used to choose visual treatment.

void badgeOpacityChanged(qreal opacity)

Opacity applied to the badge visual.

void customBackgroundColorChanged(const QColor& color)

Custom badge background color override.

void customTextColorChanged(const QColor& color)

Custom badge text color override.

void valueFontRoleChanged(Typography::FontRole role)

Typography role used by badge value text.

void beaconDiameterChanged(int diameter)

Diameter of beacon-style badge visuals.

void badgeHeightChanged(int height)

Height of pill-style badge visuals.

void valueHorizontalPaddingChanged(int padding)

Horizontal padding around badge value text.

void iconGlyphSizeChanged(int size)

Icon glyph size in pixels.

void iconFontFamilyChanged(const QString& family)

Iconfont family used for glyph rendering.

void badgeBackgroundInsetChanged(int inset)

Inset applied to badge background painting.

void contentOffsetChanged(const QPoint& offset)

Pixel offset applied to badge content drawing.

Enumerations

enum class InfoBadgeStatus
  • Informational
  • Attention
  • Caution
  • Success
  • Critical
Subclass interfaces

Methods

Inherited from fluent::FluentElement

Methods

static void setTheme(Theme theme)

Updates the global theme and notifies active FluentElement instances.

static void setThemeDeferred(Theme theme)

Schedules a visible-first batched theme refresh without blocking the current interaction.

static Theme currentTheme()

Returns the currently active global theme.

static bool themeUsesDarkAppearance(Theme theme)

Returns whether a theme uses dark-backed chrome and material tokens.

static void refreshTheme()

Re-broadcasts the current theme to repaint after a design-token change.

static int themeGeneration()

Monotonic counter bumped on every theme change, for staleness checks.

Theme effectiveTheme() const

Resolves the theme used by this element, honoring an inherited QWidget override.

bool effectiveThemeUsesDarkAppearance() const

Returns whether this element's effective theme uses dark-backed chrome.

QJsonObject themeOverrides() const

Returns this element's authored overrides.

void clearThemeOverrides()

Restores all token fields to global theme defaults.

const Colors& themeColorsRef() const

Non-copying access to the active color set (for hot paint paths).

Material::AcrylicToken themeAcrylic() const

Material, elevation, and adaptive layout tokens.

QColor themeBackdrop(bool active) const

Window-chrome backdrop color for the given activation state.

virtual void onThemeUpdated()

Called after the global theme changes.

Enumerations

enum Theme

Global visual theme used when resolving design tokens.

  • Light = 0
  • Dark = 1
  • HighContrast = 2

Types and aliases

struct Colors

Design token snapshots returned to components.

Inherited from fluent::QMLPlus

Methods

AnchorLayout::Anchors* anchors()

Returns mutable anchors for the QWidget host.

void setState(const QString& name)

Applies a named state, or clears state when name is empty.

void addState(const QMLState& state)

Registers or replaces a named state definition.

void evaluateStates()

Reevaluates conditions; the first registered true condition wins.

QMLPlusRuntime* runtime()

Returns the lazy host-owned state observation object.

void setAnchors(const AnchorLayout::Anchors& anchors)

Replaces all host anchors and invalidates the parent layout.

void resetAnchors()

Clears all host anchors and invalidates the parent layout.

void addTransition(const StateTransition& transition)

Registers a state transition in precedence order.

void setBehavior(const char* propertyName, const PropertyAnimation& animation)

Sets the default animation for this host's managed property writes.

void clearBehavior(const char* propertyName)

Removes the default animation for future managed writes.

bool writeProperty(const char* propertyName, const QVariant& value)

Writes a host property through Behavior without removing its binding.

All inherited Qt members:QWidget