Fluent-Qt

Date & time

DatePicker

A spinning-field picker for choosing a day, month, and year.

Example

DatePicker: Spinning-field date picker

Usage

Spinning-field date picker

Clicking opens looping day, month, and year columns.

#include <FluentQt/DateTime.h>
using namespace fluent::date_time;

auto* picker = new DatePicker(this);
picker->setPlaceholderText(DatePicker::DateField::Month, "month");
picker->setPlaceholderText(DatePicker::DateField::Day, "day");
picker->setPlaceholderText(DatePicker::DateField::Year, "year");
picker->setConfirmButtonAccessibleName("Accept date");
picker->setCancelButtonAccessibleName("Cancel date");
picker->setDate(QDate::currentDate());

fluent::date_time::DatePicker

Inherits fluent::basicinput::Button

Button-like date picker with nullable selected-date semantics.

Constructors

Properties

QDate date

Current date value displayed by the picker.

Read date()Write setDate()Notify dateChanged()
QDate selectedDate

Selected date; an invalid date represents no selection.

Read selectedDate()Write setSelectedDate()Reset clearSelectedDate()Notify selectedDateChanged()
QDate minimumDate

Minimum selectable date.

Read minimumDate()Write setMinimumDate()Notify minimumDateChanged()
QDate maximumDate

Maximum selectable date.

Read maximumDate()Write setMaximumDate()Notify maximumDateChanged()
bool monthVisible

Whether the month field is visible.

Read monthVisible()Write setMonthVisible()Notify monthVisibleChanged()
bool dayVisible

Whether the day field is visible.

Read dayVisible()Write setDayVisible()Notify dayVisibleChanged()
bool yearVisible

Whether the year field is visible.

Read yearVisible()Write setYearVisible()Notify yearVisibleChanged()
MonthFormat monthFormat

Format used for the month field.

Read monthFormat()Write setMonthFormat()Notify monthFormatChanged()
DayFormat dayFormat

Format used for the day field.

Read dayFormat()Write setDayFormat()Notify dayFormatChanged()
YearFormat yearFormat

Format used for the year field.

Read yearFormat()Write setYearFormat()Notify yearFormatChanged()
bool dropDownOpen

Whether the picker dropdown is open.

Read isDropDownOpen()Notify dropDownOpenChanged()
QLocale locale

Locale used for month and weekday names.

Read locale()Write setLocale()Notify localeChanged()
QString confirmButtonAccessibleName

Accessible name supplied by the application for the confirm button.

Read confirmButtonAccessibleName()Write setConfirmButtonAccessibleName()Notify confirmButtonAccessibleNameChanged()
QString cancelButtonAccessibleName

Accessible name supplied by the application for the cancel button.

Read cancelButtonAccessibleName()Write setCancelButtonAccessibleName()Notify cancelButtonAccessibleNameChanged()

Methods

QDate date() const

Current date value displayed by the picker.

QDate selectedDate() const

Selected date; an invalid date represents no selection.

QDate minimumDate() const

Minimum selectable date.

QDate maximumDate() const

Maximum selectable date.

bool monthVisible() const

Whether the month field is visible.

bool dayVisible() const

Whether the day field is visible.

bool yearVisible() const

Whether the year field is visible.

MonthFormat monthFormat() const

Format used for the month field.

DayFormat dayFormat() const

Format used for the day field.

YearFormat yearFormat() const

Format used for the year field.

QLocale locale() const

Locale used for month and weekday names.

bool isDropDownOpen() const

Whether the picker dropdown is open.

QString confirmButtonAccessibleName() const

Accessible name supplied by the application for the confirm button.

QString cancelButtonAccessibleName() const

Accessible name supplied by the application for the cancel button.

void setDate(const QDate& date)

Current date value displayed by the picker.

void setSelectedDate(const QDate& date)

Selected date; an invalid date represents no selection.

void clearSelectedDate()

Selected date; an invalid date represents no selection.

void setMonthVisible(bool visible)

Whether the month field is visible.

void setDayVisible(bool visible)

Whether the day field is visible.

void setYearVisible(bool visible)

Whether the year field is visible.

void setMonthFormat(MonthFormat format)

Format used for the month field.

void setDayFormat(DayFormat format)

Format used for the day field.

void setYearFormat(YearFormat format)

Format used for the year field.

void setLocale(const QLocale& locale)

Locale used for month and weekday names.

void setPlaceholderText(DateField field, const QString& text)

Sets application-owned placeholder text for one date field.

void setConfirmButtonAccessibleName(const QString& name)

Accessible name supplied by the application for the confirm button.

void setCancelButtonAccessibleName(const QString& name)

Accessible name supplied by the application for the cancel button.

Signals

void dateChanged(const QDate& date)

Current date value displayed by the picker.

void selectedDateChanged(const QDate& date)

Selected date; an invalid date represents no selection.

void monthVisibleChanged(bool visible)

Whether the month field is visible.

void dayVisibleChanged(bool visible)

Whether the day field is visible.

void yearVisibleChanged(bool visible)

Whether the year field is visible.

void localeChanged(const QLocale& locale)

Locale used for month and weekday names.

void confirmButtonAccessibleNameChanged(const QString& name)

Accessible name supplied by the application for the confirm button.

void cancelButtonAccessibleNameChanged(const QString& name)

Accessible name supplied by the application for the cancel button.

void dropDownOpenChanged(bool open)

Whether the picker dropdown is open.

Enumerations

enum class MonthFormat
  • FullMonthName
  • AbbreviatedMonthName
  • NumericMonth
  • TwoDigitMonth
enum class DayFormat
  • DayInteger
  • TwoDigitDay
  • DayIntegerWithAbbreviatedWeekday
enum class YearFormat
  • FullYear
  • TwoDigitYear

Destructors

Subclass interfaces

Methods

Inherited from fluent::basicinput::Button

Properties

ButtonStyle fluentStyle

Visual treatment: Standard, Accent, or Subtle.

Read fluentStyle()Write setFluentStyle()Notify fluentStyleChanged()
ButtonSize fluentSize

Density token that controls height and padding, not typography.

Read fluentSize()Write setFluentSize()Notify fluentSizeChanged()
Typography::FontRole fontRole

Fluent typography role used while the button follows theme fonts.

Read fontRole()Write setFontRole()Notify fontRoleChanged()
TextColorRole textColorRole

Semantic foreground for unfilled, unchecked buttons; filled and disabled states keep their contrast roles.

Read textColorRole()Write setTextColorRole()Notify textColorRoleChanged()
ButtonLayout fluentLayout

Content layout for text and icon placement.

Read fluentLayout()Write setFluentLayout()Notify fluentLayoutChanged()
bool focusVisual

Controls whether the focus visual frame is painted.

Read hasFocusVisual()Write setFocusVisual()Notify focusVisualChanged()
InteractionState interactionState

Overrides the interaction state for guided demos or visual checks.

Read interactionState()Write setInteractionState()Notify interactionStateChanged()
bool criticalOnHover

Uses the critical semantic color while hovered or pressed.

Read criticalOnHover()Write setCriticalOnHover()Notify criticalOnHoverChanged()
QMargins cornerRadii

Per-corner radii; left/top/right/bottom map to top-left/top-right/bottom-right/bottom-left.

Read cornerRadii()Write setCornerRadii()Reset resetCornerRadii()Notify cornerRadiiChanged()
QPoint iconOffset

Pixel offset applied to iconfont drawing; positive values move right/down.

Read iconOffset()Write setIconOffset()
qreal iconRotation

Clockwise rotation applied to the painted icon in degrees.

Read iconRotation()Write setIconRotation()
qreal iconScale

Uniform scale applied to the painted iconfont glyph (1.0 = no scaling). Drives WinUI-style press feedback (a brief scale-down) without touching geometry.

Read iconScale()Write setIconScale()
qreal contentOpacity

Painter-level opacity for the whole button surface (1.0 = fully opaque). A lightweight fade that avoids QGraphicsOpacityEffect's offscreen compositing.

Read contentOpacity()Write setContentOpacity()

Methods

ButtonStyle fluentStyle() const

Fluent property accessors.

void setFluentStyle(ButtonStyle style)

Visual treatment: Standard, Accent, or Subtle.

ButtonSize fluentSize() const

Density token that controls height and padding, not typography.

void setFluentSize(ButtonSize size)

Density token that controls height and padding, not typography.

Typography::FontRole fontRole() const

Fluent typography role used while the button follows theme fonts.

void setFontRole(Typography::FontRole role)

Fluent typography role used while the button follows theme fonts.

TextColorRole textColorRole() const

Semantic foreground for unfilled, unchecked buttons; filled and disabled states keep their contrast roles.

void setTextColorRole(TextColorRole role)

Semantic foreground for unfilled, unchecked buttons; filled and disabled states keep their contrast roles.

void setFont(const QFont& font)

Sets an explicit font that remains unchanged by later theme refreshes.

ButtonLayout fluentLayout() const

Content layout for text and icon placement.

void setFluentLayout(ButtonLayout layout)

Content layout for text and icon placement.

bool hasFocusVisual() const

Controls whether the focus visual frame is painted.

void setFocusVisual(bool focus)

Controls whether the focus visual frame is painted.

InteractionState interactionState() const

Overrides the interaction state for guided demos or visual checks.

void setInteractionState(InteractionState state)

Overrides the interaction state for guided demos or visual checks.

bool criticalOnHover() const

Uses the critical semantic color while hovered or pressed.

void setCriticalOnHover(bool enabled)

Uses the critical semantic color while hovered or pressed.

QMargins cornerRadii() const

Per-corner radii; left/top/right/bottom map to top-left/top-right/bottom-right/bottom-left.

void setCornerRadii(const QMargins& radii)

Per-corner radii; left/top/right/bottom map to top-left/top-right/bottom-right/bottom-left.

void resetCornerRadii()

Per-corner radii; left/top/right/bottom map to top-left/top-right/bottom-right/bottom-left.

QPoint iconOffset() const

Pixel offset applied to iconfont drawing; positive values move right/down.

void setIconOffset(const QPoint& offset)

Pixel offset applied to iconfont drawing; positive values move right/down.

qreal iconRotation() const

Clockwise rotation applied to the painted icon in degrees.

void setIconRotation(qreal rotation)

Clockwise rotation applied to the painted icon in degrees.

qreal iconScale() const

Uniform scale applied to the painted iconfont glyph (1.0 = no scaling). Drives WinUI-style press feedback (a brief scale-down) without touching geometry.

void setIconScale(qreal scale)

Uniform scale applied to the painted iconfont glyph (1.0 = no scaling). Drives WinUI-style press feedback (a brief scale-down) without touching geometry.

qreal contentOpacity() const

Painter-level opacity for the whole button surface (1.0 = fully opaque). A lightweight fade that avoids QGraphicsOpacityEffect's offscreen compositing.

void setContentOpacity(qreal opacity)

Painter-level opacity for the whole button surface (1.0 = fully opaque). A lightweight fade that avoids QGraphicsOpacityEffect's offscreen compositing.

QSize sizeHint() const override

Size hints include Fluent padding, text, and iconfont content.

Signals

void fluentStyleChanged()

Visual treatment: Standard, Accent, or Subtle.

void fluentSizeChanged()

Density token that controls height and padding, not typography.

void fontRoleChanged()

Fluent typography role used while the button follows theme fonts.

void textColorRoleChanged()

Semantic foreground for unfilled, unchecked buttons; filled and disabled states keep their contrast roles.

void fluentLayoutChanged()

Content layout for text and icon placement.

void focusVisualChanged()

Controls whether the focus visual frame is painted.

void interactionStateChanged()

Overrides the interaction state for guided demos or visual checks.

void criticalOnHoverChanged()

Uses the critical semantic color while hovered or pressed.

void cornerRadiiChanged()

Per-corner radii; left/top/right/bottom map to top-left/top-right/bottom-right/bottom-left.

Enumerations

enum ButtonStyle

Button visual style resolved against Fluent design tokens.

  • Standard
  • Accent
  • Subtle
enum ButtonSize

Button density presets for padding and preferred height.

  • Small
  • StandardSize
  • Large
enum ButtonLayout

Text/icon composition mode.

  • TextOnly
  • IconBefore
  • IconOnly
  • IconAfter
enum class TextColorRole

Semantic text and icon emphasis.

  • Primary
  • Secondary
  • Accent
enum InteractionState

Paint-state override used before falling back to real hover/press state.

  • Rest
  • Hover
  • Pressed
  • Disabled
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:QPushButton