Fluent-Qt

Date & time

CalendarView

A calendar surface for browsing months and selecting dates.

Example

CalendarView: Browse and select dates

Usage

Browse and select dates

Click the title to zoom out to months and years.

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

auto* calendar = new CalendarView(this);
calendar->setSelectedDate(QDate::currentDate());

fluent::date_time::CalendarView

Inherits QWidget · FluentElement · QMLPlus

Fluent calendar surface for browsing and selecting dates across levels.

Constructors

Properties

QDate selectedDate

Selected date; an invalid date represents no selection.

Read selectedDate()Write setSelectedDate()Notify selectedDateChanged()
QDate visibleMonth

Month currently displayed by CalendarView.

Read visibleMonth()Write setVisibleMonth()Notify visibleMonthChanged()
QDate minDate

Minimum date accepted by the calendar surface.

Read minDate()Write setMinDate()Notify minDateChanged()
QDate maxDate

Maximum date accepted by the calendar surface.

Read maxDate()Write setMaxDate()Notify maxDateChanged()
QLocale locale

Locale used for calendar names and the automatic first weekday.

Read locale()Write setLocale()Notify localeChanged()
Qt::DayOfWeek firstDayOfWeek

First day used when laying out calendar weeks.

Read firstDayOfWeek()Write setFirstDayOfWeek()Reset resetFirstDayOfWeek()Notify firstDayOfWeekChanged()
CalendarContentLevel contentLevel

Calendar content level currently displayed.

Read contentLevel()Write setContentLevel()Notify contentLevelChanged()
bool frameVisible

Whether CalendarView paints its outer frame.

Read isFrameVisible()Write setFrameVisible()Notify frameVisibleChanged()

Methods

QDate selectedDate() const

Selected date; an invalid date represents no selection.

QDate visibleMonth() const

Month currently displayed by CalendarView.

QDate minDate() const

Minimum date accepted by the calendar surface.

QDate maxDate() const

Maximum date accepted by the calendar surface.

QLocale locale() const

Locale used for calendar names and the automatic first weekday.

Qt::DayOfWeek firstDayOfWeek() const

First day used when laying out calendar weeks.

CalendarContentLevel contentLevel() const

Calendar content level currently displayed.

bool isFrameVisible() const

Whether CalendarView paints its outer frame.

void setSelectedDate(const QDate& date)

Selected date; an invalid date represents no selection.

void setVisibleMonth(const QDate& month)

Month currently displayed by CalendarView.

void setMinDate(const QDate& date)

Minimum date accepted by the calendar surface.

void setMaxDate(const QDate& date)

Maximum date accepted by the calendar surface.

void setLocale(const QLocale& locale)

Locale used for calendar names and the automatic first weekday.

void setFirstDayOfWeek(Qt::DayOfWeek day)

First day used when laying out calendar weeks.

void resetFirstDayOfWeek()

First day used when laying out calendar weeks.

void setContentLevel(CalendarContentLevel level)

Calendar content level currently displayed.

void setFrameVisible(bool visible)

Whether CalendarView paints its outer frame.

Signals

void selectedDateChanged(const QDate& date)

Selected date; an invalid date represents no selection.

void visibleMonthChanged(const QDate& month)

Month currently displayed by CalendarView.

void minDateChanged(const QDate& date)

Minimum date accepted by the calendar surface.

void maxDateChanged(const QDate& date)

Maximum date accepted by the calendar surface.

void localeChanged(const QLocale& locale)

Locale used for calendar names and the automatic first weekday.

void firstDayOfWeekChanged(Qt::DayOfWeek day)

First day used when laying out calendar weeks.

void contentLevelChanged(CalendarContentLevel level)

Calendar content level currently displayed.

void frameVisibleChanged(bool visible)

Whether CalendarView paints its outer frame.

Enumerations

Destructors

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