Text fields
NumberBox
A numeric input with spin buttons and inline expression support.
Example

Usage
Drag to adjust a value
Drag the handle for a live preview. Shift makes fine changes; Escape restores the starting value.
#include <FluentQt/TextFields.h>
using namespace fluent::textfields;
auto* number = new NumberBox(this);
number->setObjectName("scrubNumber");
number->setAccessibleName("Rotation angle");
number->setHeader("Rotation angle");
number->setRange(-180, 180);
number->setValue(30);
number->setScrubbingEnabled(true);
number->setScrubSensitivity(0.5);
number->setDisplayPrecision(1);
number->setFixedWidth(260);import fluentqt
number = fluentqt.NumberBox()
number.setObjectName("scrubNumber")
number.setAccessibleName("Rotation angle")
number.setHeader("Rotation angle")
number.setRange(-180, 180)
number.setValue(30)
number.setScrubbingEnabled(True)
number.setScrubSensitivity(0.5)
number.setDisplayPrecision(1)
number.setFixedWidth(260)API
DeclarationNo matching API members.
fluent::textfields::NumberBox
Inherits LineEdit
Numeric LineEdit with value bounds, expression input, and spin buttons.
Constructors
Properties
double valueCurrent numeric value committed by the input.
Readvalue()WritesetValue()NotifyvalueChanged()double minimumLower bound used to clamp typed and stepped values.
Readminimum()WritesetMinimum()NotifyminimumChanged()double maximumUpper bound used to clamp typed and stepped values.
Readmaximum()WritesetMaximum()NotifymaximumChanged()double smallChangeIncrement used by one spin-button click or small keyboard step.
ReadsmallChange()WritesetSmallChange()NotifysmallChangeChanged()double largeChangeIncrement used by large-step keyboard actions.
ReadlargeChange()WritesetLargeChange()NotifylargeChangeChanged()QString headerOptional label text displayed above the numeric input row.
Readheader()WritesetHeader()NotifyheaderChanged()bool acceptsExpressionWhether typed arithmetic expressions are evaluated before commit.
ReadacceptsExpression()WritesetAcceptsExpression()NotifyacceptsExpressionChanged()SpinButtonPlacementMode spinButtonPlacementModePlacement mode for hidden, compact, or inline spin buttons.
ReadspinButtonPlacementMode()WritesetSpinButtonPlacementMode()NotifyspinButtonPlacementModeChanged()QSize spinButtonSizeSize of external spin buttons.
ReadspinButtonSize()WritesetSpinButtonSize()NotifyspinButtonSizeChanged()QSize inlineSpinButtonSizeSize of inline spin buttons.
ReadinlineSpinButtonSize()WritesetInlineSpinButtonSize()NotifyinlineSpinButtonSizeChanged()int spinButtonRightMarginRight-side inset reserved between inline spin buttons and the frame.
ReadspinButtonRightMargin()WritesetSpinButtonRightMargin()NotifyspinButtonRightMarginChanged()int compactSpinButtonReservedWidthWidth reserved for compact spin buttons inside the input surface.
ReadcompactSpinButtonReservedWidth()WritesetCompactSpinButtonReservedWidth()NotifycompactSpinButtonReservedWidthChanged()int spinButtonSpacingSpacing between adjacent spin buttons.
ReadspinButtonSpacing()WritesetSpinButtonSpacing()NotifyspinButtonSpacingChanged()int spinButtonTextGapGap between text content and inline spin-button chrome.
ReadspinButtonTextGap()WritesetSpinButtonTextGap()NotifyspinButtonTextGapChanged()int spinButtonIconSizeIcon glyph size used by spin-button chevrons.
ReadspinButtonIconSize()WritesetSpinButtonIconSize()NotifyspinButtonIconSizeChanged()int displayPrecisionNumber of fractional digits used when formatting the value.
ReaddisplayPrecision()WritesetDisplayPrecision()NotifydisplayPrecisionChanged()double formatStepStep used to normalize display rounding after value changes.
ReadformatStep()WritesetFormatStep()NotifyformatStepChanged()bool scrubbingEnabledEnables the separate horizontal drag handle; text selection stays unchanged.
ReadisScrubbingEnabled()WritesetScrubbingEnabled()NotifyscrubbingEnabledChanged()double scrubSensitivityValue units per logical pixel; must be finite and positive.
ReadscrubSensitivity()WritesetScrubSensitivity()NotifyscrubSensitivityChanged()bool scrubbingWhether a drag transaction is active.
ReadisScrubbing()NotifyscrubbingChanged()
Methods
double value() constCurrent numeric value committed by the input.
void setValue(double value)Current numeric value committed by the input.
double minimum() constLower bound used to clamp typed and stepped values.
void setMinimum(double minimum)Lower bound used to clamp typed and stepped values.
double maximum() constUpper bound used to clamp typed and stepped values.
void setMaximum(double maximum)Upper bound used to clamp typed and stepped values.
double smallChange() constIncrement used by one spin-button click or small keyboard step.
void setSmallChange(double change)Increment used by one spin-button click or small keyboard step.
double largeChange() constIncrement used by large-step keyboard actions.
void setLargeChange(double change)Increment used by large-step keyboard actions.
QString header() constOptional label text displayed above the numeric input row.
void setHeader(const QString& header)Optional label text displayed above the numeric input row.
bool acceptsExpression() constWhether typed arithmetic expressions are evaluated before commit.
void setAcceptsExpression(bool accepts)Whether typed arithmetic expressions are evaluated before commit.
SpinButtonPlacementMode spinButtonPlacementMode() constPlacement mode for hidden, compact, or inline spin buttons.
void setSpinButtonPlacementMode(SpinButtonPlacementMode mode)Placement mode for hidden, compact, or inline spin buttons.
QSize spinButtonSize() constSize of external spin buttons.
void setSpinButtonSize(const QSize& size)Size of external spin buttons.
QSize inlineSpinButtonSize() constSize of inline spin buttons.
void setInlineSpinButtonSize(const QSize& size)Size of inline spin buttons.
int spinButtonRightMargin() constRight-side inset reserved between inline spin buttons and the frame.
void setSpinButtonRightMargin(int margin)Right-side inset reserved between inline spin buttons and the frame.
int compactSpinButtonReservedWidth() constWidth reserved for compact spin buttons inside the input surface.
void setCompactSpinButtonReservedWidth(int width)Width reserved for compact spin buttons inside the input surface.
int spinButtonSpacing() constSpacing between adjacent spin buttons.
void setSpinButtonSpacing(int spacing)Spacing between adjacent spin buttons.
int spinButtonTextGap() constGap between text content and inline spin-button chrome.
void setSpinButtonTextGap(int gap)Gap between text content and inline spin-button chrome.
int spinButtonIconSize() constIcon glyph size used by spin-button chevrons.
void setSpinButtonIconSize(int size)Icon glyph size used by spin-button chevrons.
int displayPrecision() constNumber of fractional digits used when formatting the value.
void setDisplayPrecision(int precision)Number of fractional digits used when formatting the value.
double formatStep() constStep used to normalize display rounding after value changes.
void setFormatStep(double step)Step used to normalize display rounding after value changes.
bool isScrubbingEnabled() constEnables the separate horizontal drag handle; text selection stays unchanged.
void setScrubbingEnabled(bool enabled)Enables the separate horizontal drag handle; text selection stays unchanged.
double scrubSensitivity() constValue units per logical pixel; must be finite and positive.
void setScrubSensitivity(double sensitivity)Value units per logical pixel; must be finite and positive.
bool isScrubbing() constWhether a drag transaction is active.
QRect scrubHandleRect() constLogical handle geometry, empty while disabled.
void cancelScrub()Rolls back an active drag, including an initially empty value.
void commitInput()Commits current text using the numeric bounds and expression policy. Invalid input retains its text and sets value to NaN; unchanged formatted text preserves the original precision. No external model is modified.
Signals
void valueChanged(double value)Current numeric value committed by the input.
void minimumChanged(double minimum)Lower bound used to clamp typed and stepped values.
void maximumChanged(double maximum)Upper bound used to clamp typed and stepped values.
void smallChangeChanged(double change)Increment used by one spin-button click or small keyboard step.
void largeChangeChanged(double change)Increment used by large-step keyboard actions.
void headerChanged()Optional label text displayed above the numeric input row.
void acceptsExpressionChanged(bool accepts)Whether typed arithmetic expressions are evaluated before commit.
void spinButtonPlacementModeChanged(SpinButtonPlacementMode mode)Placement mode for hidden, compact, or inline spin buttons.
void spinButtonSizeChanged(const QSize& size)Size of external spin buttons.
void inlineSpinButtonSizeChanged(const QSize& size)Size of inline spin buttons.
void spinButtonRightMarginChanged(int margin)Right-side inset reserved between inline spin buttons and the frame.
void compactSpinButtonReservedWidthChanged(int width)Width reserved for compact spin buttons inside the input surface.
void spinButtonSpacingChanged(int spacing)Spacing between adjacent spin buttons.
void spinButtonTextGapChanged(int gap)Gap between text content and inline spin-button chrome.
void spinButtonIconSizeChanged(int size)Icon glyph size used by spin-button chevrons.
void displayPrecisionChanged(int precision)Number of fractional digits used when formatting the value.
void formatStepChanged(double step)Step used to normalize display rounding after value changes.
void scrubbingEnabledChanged(bool enabled)Enables the separate horizontal drag handle; text selection stays unchanged.
void scrubSensitivityChanged(double sensitivity)Value units per logical pixel; must be finite and positive.
void scrubbingChanged(bool scrubbing)Whether a drag transaction is active.
void scrubStarted(double initialValue)One transaction starts; valueChanged still reports each live value.
void scrubFinished(double initialValue, double finalValue, bool canceled)Ends once; cancellation restores initialValue before this signal.
Enumerations
enum class SpinButtonPlacementModeHiddenCompactInline
Subclass interfaces
Methods
Inherited from fluent::textfields::LineEdit
Properties
QMargins contentMarginsContent margins whose horizontal values include Qt's internal text inset.
ReadcontentMargins()WritesetContentMargins()NotifycontentMarginsChanged()Typography::FontRole fontRoleFluent typography role used for text rendering.
ReadfontRole()WritesetFontRole()NotifyfontRoleChanged()bool clearButtonEnabledWhether the trailing clear button is enabled.
ReadisClearButtonEnabled()WritesetClearButtonEnabled()NotifyclearButtonEnabledChanged()int clearButtonSizeSize of the clear button, defaulting to 24 logical pixels.
ReadclearButtonSize()WritesetClearButtonSize()NotifyclearButtonSizeChanged()QPoint clearButtonOffsetPixel offset applied to the clear button.
ReadclearButtonOffset()WritesetClearButtonOffset()NotifyclearButtonOffsetChanged()int focusedBorderWidthBottom border width while focused.
ReadfocusedBorderWidth()WritesetFocusedBorderWidth()NotifyfocusedBorderWidthChanged()int unfocusedBorderWidthBottom border width while not focused.
ReadunfocusedBorderWidth()WritesetUnfocusedBorderWidth()NotifyunfocusedBorderWidthChanged()bool frameVisibleWhether LineEdit paints its input frame and focus underline.
ReadisFrameVisible()WritesetFrameVisible()NotifyframeVisibleChanged()QString trailingText- Read
trailingText()WritesetTrailingText()NotifytrailingTextChanged() QWidget* trailingWidget- Read
trailingWidget()NotifytrailingWidgetChanged() fluent::WidgetOwnership trailingWidgetOwnership- Read
trailingWidgetOwnership()NotifytrailingWidgetOwnershipChanged() QString clearButtonAccessibleName- Read
clearButtonAccessibleName()WritesetClearButtonAccessibleName()NotifyclearButtonAccessibleNameChanged() Qt::FocusPolicy clearButtonFocusPolicy- Read
clearButtonFocusPolicy()WritesetClearButtonFocusPolicy()NotifyclearButtonFocusPolicyChanged()
Methods
QMargins contentMargins() constContent 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() constFluent typography role used for text rendering.
void setFontRole(Typography::FontRole role)Fluent typography role used for text rendering.
bool isClearButtonEnabled() constWhether the trailing clear button is enabled.
void setClearButtonEnabled(bool enabled)Whether the trailing clear button is enabled.
int clearButtonSize() constSize 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() constPixel offset applied to the clear button.
void setClearButtonOffset(const QPoint& offset)Pixel offset applied to the clear button.
int focusedBorderWidth() constBottom border width while focused.
void setFocusedBorderWidth(int width)Bottom border width while focused.
int unfocusedBorderWidth() constBottom border width while not focused.
void setUnfocusedBorderWidth(int width)Bottom border width while not focused.
bool isFrameVisible() constWhether 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() constResolves the theme used by this element, honoring an inherited QWidget override.
bool effectiveThemeUsesDarkAppearance() constReturns whether this element's effective theme uses dark-backed chrome.
bool setThemeOverrides(const QJsonObject& overrides)Component-facing token accessors.
QJsonObject themeOverrides() constReturns this element's authored overrides.
void clearThemeOverrides()Restores all token fields to global theme defaults.
const Colors& themeColorsRef() constNon-copying access to the active color set (for hot paint paths).
Material::AcrylicToken themeAcrylic() constMaterial, elevation, and adaptive layout tokens.
QColor themeBackdrop(bool active) constWindow-chrome backdrop color for the given activation state.
virtual void onThemeUpdated()Called after the global theme changes.
Enumerations
enum ThemeGlobal visual theme used when resolving design tokens.
Light = 0Dark = 1HighContrast = 2
Types and aliases
struct ColorsDesign 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 bind(const char* targetProp, QObject* source, const char* sourceProp, PropertyBinder::Direction dir = PropertyBinder::OneWay)Binds a source property to a property on the QWidget host.
BindingHandle bindManaged(const char* targetProp, QObject* source, const char* sourceProp, PropertyBinder::Direction direction = PropertyBinder::OneWay, BindingOptions options = {})Installs a managed direct binding on this QWidget host.
BindingHandle bindComputed(const char* targetProp, const QVector<BindingDependency>& dependencies, std::function<QVariant()> evaluate, BindingOptions options = {})Installs an explicit-dependency C++ expression on this QWidget host.
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