Fluent-Qt

Basic input

ComboBox

A drop-down list for selecting one item from a set of options.

Example

ComboBox: ComboBox selection

Usage

ComboBox selection

Selecting an item updates the current index and current text.

#include <FluentQt/BasicInput.h>
using namespace fluent::basicinput;

auto* comboBox = new ComboBox(this);
comboBox->addItems({"Blue", "Green", "Red", "Yellow"});
comboBox->setCurrentIndex(0);
connect(comboBox, qOverload<int>(&ComboBox::currentIndexChanged),
        this, [=](int index) {
            status->setText(comboBox->currentText());
        });

fluent::basicinput::ComboBox

Inherits QComboBox · FluentElement · QMLPlus

Fluent combo box with custom popup and token-driven button surface.

Constructors

Properties

Typography::FontRole fontRole

Fluent typography role used for text rendering.

Read fontRole()Write setFontRole()Notify fontRoleChanged()
int contentPaddingH

Horizontal content padding in pixels.

Read contentPaddingH()Write setContentPaddingH()Notify layoutChanged()
int contentPaddingV

Vertical content padding in pixels.

Read contentPaddingV()Write setContentPaddingV()Notify layoutChanged()
QString chevronGlyph

Iconfont glyph used for the chevron affordance.

Read chevronGlyph()Write setChevronGlyph()Notify chevronChanged()
int chevronSize

Chevron glyph pixel size.

Read chevronSize()Write setChevronSize()Notify chevronChanged()
QPoint chevronOffset

Pixel offset applied to chevron drawing.

Read chevronOffset()Write setChevronOffset()Notify chevronChanged()
int popupOffset

Popup offset from its anchor in pixels.

Read popupOffset()Write setPopupOffset()Notify layoutChanged()
qreal pressProgress

Animated press progress used by the painted surface.

Read pressProgress()Write setPressProgress()
QString trailingText
Read trailingText()Write setTrailingText()Notify trailingTextChanged()
QWidget* trailingWidget
Read trailingWidget()Notify trailingWidgetChanged()
fluent::WidgetOwnership trailingWidgetOwnership
Read trailingWidgetOwnership()Notify trailingWidgetOwnershipChanged()

Methods

void setFontRole(Typography::FontRole role)

Restores theme-managed typography, even when the role is unchanged.

void setFont(const QFont& font)

Sets the field, editor and dropdown font independently of theme refreshes.

int contentPaddingH() const

Horizontal content padding in pixels.

void setContentPaddingH(int px)

Horizontal content padding in pixels.

int contentPaddingV() const

Vertical content padding in pixels.

void setContentPaddingV(int px)

Vertical content padding in pixels.

QString chevronGlyph() const

Iconfont glyph used for the chevron affordance.

void setChevronGlyph(const QString& glyph)

Iconfont glyph used for the chevron affordance.

int chevronSize() const

Chevron glyph pixel size.

void setChevronSize(int size)

Chevron glyph pixel size.

QPoint chevronOffset() const

Pixel offset applied to chevron drawing.

void setChevronOffset(const QPoint& offset)

Pixel offset applied to chevron drawing.

int popupOffset() const

Popup offset from its anchor in pixels.

void setPopupOffset(int offset)

Popup offset from its anchor in pixels.

qreal pressProgress() const

Animated press progress used by the painted surface.

void setPressProgress(qreal p)

Animated press progress used by the painted surface.

void setLineEdit(QLineEdit* edit)

Replaces the QComboBox editor and synchronizes Fluent layout state.

void setTrailingText(const QString& text)

Displays a plain-text suffix in both editing modes without changing item values.

bool setTrailingWidget(QWidget* widget, WidgetOwnership ownership)

Hosts one trailing widget outside the editor, replacing suffix text.

QWidget* takeTrailingWidget()

Detaches custom trailing content and transfers it to the caller.

void releaseTrailingWidget()

Releases custom trailing content according to its recorded ownership policy.

QAbstractItemModel* model() const

--- QComboBox overrides ---

Signals

void fontRoleChanged()

Fluent typography role used for text rendering.

void layoutChanged()

Horizontal content padding in pixels.

void chevronChanged()

Iconfont glyph used for the chevron affordance.

Destructors

PySide6 additions

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:QComboBox

fluent::basicinput::ComboBoxItemDelegate

Inherits QStyledItemDelegate

─── ComboBox popup delegate.

Constructors

Methods