Fluent-Qt

Text fields

PasswordBox

A text box that conceals input with an optional reveal button.

Example

PasswordBox: Password value

Usage

Password value

Password text is stored separately from presentation and emits passwordChanged.

#include <FluentQt/TextFields.h>
using namespace fluent::textfields;

auto* passwordBox = new PasswordBox(this);
passwordBox->setPassword("Fluent123");

connect(passwordBox, &PasswordBox::passwordChanged,
        statusLabel, [statusLabel](const QString& password) {
            statusLabel->setText(QStringLiteral("Length: %1").arg(password.size()));
        });

fluent::textfields::PasswordBox

Inherits LineEdit

Password text field with header and reveal-mode support.

Constructors

Properties

QString password

Password text stored by the password box.

Read password()Write setPassword()Notify passwordChanged()
QString header

Optional label text displayed above the password input row.

Read header()Write setHeader()Notify headerChanged()
PasswordRevealMode passwordRevealMode

Mode controlling whether password text can be revealed.

Read passwordRevealMode()Write setPasswordRevealMode()Notify passwordRevealModeChanged()

Methods

QString password() const

Password text stored by the password box.

QString header() const

Optional label text displayed above the password input row.

PasswordRevealMode passwordRevealMode() const

Mode controlling whether password text can be revealed.

void setHeader(const QString& header)

Optional label text displayed above the password input row.

void setPasswordRevealMode(PasswordRevealMode mode)

Mode controlling whether password text can be revealed.

void setPassword(const QString& password)

Password text stored by the password box.

Signals

void passwordChanged(const QString& password)

Password text stored by the password box.

void headerChanged()

Optional label text displayed above the password input row.

void passwordRevealModeChanged()

Mode controlling whether password text can be revealed.

Enumerations

Subclass interfaces

Methods

Inherited from fluent::textfields::LineEdit

Properties

QMargins contentMargins

Content margins whose horizontal values include Qt's internal text inset.

Read contentMargins()Write setContentMargins()Notify contentMarginsChanged()
Typography::FontRole fontRole

Fluent typography role used for text rendering.

Read fontRole()Write setFontRole()Notify fontRoleChanged()
bool clearButtonEnabled

Whether the trailing clear button is enabled.

Read isClearButtonEnabled()Write setClearButtonEnabled()Notify clearButtonEnabledChanged()
int clearButtonSize

Size of the clear button, defaulting to 24 logical pixels.

Read clearButtonSize()Write setClearButtonSize()Notify clearButtonSizeChanged()
QPoint clearButtonOffset

Pixel offset applied to the clear button.

Read clearButtonOffset()Write setClearButtonOffset()Notify clearButtonOffsetChanged()
int focusedBorderWidth

Bottom border width while focused.

Read focusedBorderWidth()Write setFocusedBorderWidth()Notify focusedBorderWidthChanged()
int unfocusedBorderWidth

Bottom border width while not focused.

Read unfocusedBorderWidth()Write setUnfocusedBorderWidth()Notify unfocusedBorderWidthChanged()
bool frameVisible

Whether LineEdit paints its input frame and focus underline.

Read isFrameVisible()Write setFrameVisible()Notify frameVisibleChanged()
QString trailingText
Read trailingText()Write setTrailingText()Notify trailingTextChanged()
QWidget* trailingWidget
Read trailingWidget()Notify trailingWidgetChanged()
fluent::WidgetOwnership trailingWidgetOwnership
Read trailingWidgetOwnership()Notify trailingWidgetOwnershipChanged()
QString clearButtonAccessibleName
Read clearButtonAccessibleName()Write setClearButtonAccessibleName()Notify clearButtonAccessibleNameChanged()
Qt::FocusPolicy clearButtonFocusPolicy
Read clearButtonFocusPolicy()Write setClearButtonFocusPolicy()Notify clearButtonFocusPolicyChanged()

Methods

QMargins contentMargins() const

Content margins whose horizontal values include Qt's internal text inset.

void setContentMargins(const QMargins& margins)

Content margins whose horizontal values include Qt's internal text inset.

Typography::FontRole fontRole() const

Fluent typography role used for text rendering.

void setFontRole(Typography::FontRole role)

Fluent typography role used for text rendering.

bool isClearButtonEnabled() const

Whether the trailing clear button is enabled.

void setClearButtonEnabled(bool enabled)

Whether the trailing clear button is enabled.

int clearButtonSize() const

Size of the clear button, defaulting to 24 logical pixels.

void setClearButtonSize(int size)

Size of the clear button, defaulting to 24 logical pixels.

QPoint clearButtonOffset() const

Pixel offset applied to the clear button.

void setClearButtonOffset(const QPoint& offset)

Pixel offset applied to the clear button.

int focusedBorderWidth() const

Bottom border width while focused.

void setFocusedBorderWidth(int width)

Bottom border width while focused.

int unfocusedBorderWidth() const

Bottom border width while not focused.

void setUnfocusedBorderWidth(int width)

Bottom border width while not focused.

bool isFrameVisible() const

Whether LineEdit paints its input frame and focus underline.

void setFrameVisible(bool visible)

Whether LineEdit paints its input frame and focus underline.

void setTrailingText(const QString& text)

Displays a plain-text suffix without changing the editable value; replaces hosted content.

bool setTrailingWidget(QWidget* widget, WidgetOwnership ownership)

Hosts one trailing widget using explicit ownership; rejects the host and its ancestors.

QWidget* takeTrailingWidget()

Detaches the custom trailing widget and transfers it to the caller.

void releaseTrailingWidget()

Releases custom trailing content according to its recorded ownership policy.

Signals

void contentMarginsChanged()

Content margins whose horizontal values include Qt's internal text inset.

void fontRoleChanged()

Fluent typography role used for text rendering.

void clearButtonEnabledChanged()

Whether the trailing clear button is enabled.

void clearButtonSizeChanged()

Size of the clear button, defaulting to 24 logical pixels.

void clearButtonOffsetChanged()

Pixel offset applied to the clear button.

void focusedBorderWidthChanged()

Bottom border width while focused.

void unfocusedBorderWidthChanged()

Bottom border width while not focused.

void frameVisibleChanged()

Whether LineEdit paints its input frame and focus underline.

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