Fluent-Qt

Collections

DrawerView

A panel that slides in from a window edge over the content.

Example

DrawerView: Right-edge drawer

Usage

Right-edge drawer

The drawer slides over the hosting surface and dismisses on outside click.

#include <FluentQt/Collections.h>
using namespace fluent::collections;

auto* drawer = new DrawerView(host);
drawer->setEdge(DrawerView::DrawerEdge::Right);
drawer->setDrawerLength(260);
drawer->setContentWidget(settingsPanel, WidgetOwnership::Owned);
auto* openButton = new Button("Open drawer", host);
QObject::connect(openButton, &Button::clicked,
                 drawer, &DrawerView::open);

fluent::collections::DrawerView

Inherits QWidget · FluentElement · QMLPlus

Same-window drawer overlay with modal, dim, and drag behavior.

Constructors

Properties

bool isOpen

Whether the popup, drawer, or notification surface is open.

Read isOpen()Write setIsOpen()Notify isOpenChanged()
DrawerEdge edge

Window edge from which the drawer appears.

Read edge()Write setEdge()Notify edgeChanged()
qreal position

Animated drawer position along its opening axis.

Read position()Write setPosition()Notify positionChanged()
int drawerLength

Drawer length measured along the opening axis.

Read drawerLength()Write setDrawerLength()Notify drawerLengthChanged()
QMargins availableMargins

Margins removed from the owning window before drawer placement.

Read availableMargins()Write setAvailableMargins()Notify availableMarginsChanged()
bool modal

Whether the overlay blocks interaction outside itself.

Read isModal()Write setModal()Notify modalChanged()
bool dim

Whether a dim/scrim layer is shown behind the overlay.

Read isDim()Write setDim()Notify dimChanged()
double dimOpacity

Scrim opacity in [0, 1]; -1 uses the theme smoke token when dim is enabled.

Read dimOpacity()Write setDimOpacity()Notify dimOpacityChanged()
double backdropBlurRadius

Cached owning-window blur radius in logical pixels [0, 32]; 0 disables blur.

Read backdropBlurRadius()Write setBackdropBlurRadius()Notify backdropBlurRadiusChanged()
ClosePolicy closePolicy

Policy controlling outside-click, escape, or programmatic close behavior.

Read closePolicy()Write setClosePolicy()Notify closePolicyChanged()
bool interactive

Whether pointer dragging can interact with the drawer.

Read isInteractive()Write setInteractive()Notify interactiveChanged()
int dragMargin

Edge margin used to begin drawer dragging.

Read dragMargin()Write setDragMargin()Notify dragMarginChanged()
int outerCornerRadius

Corner radius used on the drawer outer edge.

Read outerCornerRadius()Write setOuterCornerRadius()Notify outerCornerRadiusChanged()
bool animationEnabled

Whether drawer open/close transitions are animated.

Read isAnimationEnabled()Write setAnimationEnabled()Notify animationEnabledChanged()
QWidget* contentWidget

Widget hosted inside the drawer panel.

Read contentWidget()Write setContentWidget()Notify contentWidgetChanged()
fluent::WidgetOwnership contentOwnership

Release policy for the current content widget.

Read contentOwnership()Notify contentOwnershipChanged()

Methods

bool isOpen() const

Whether the popup, drawer, or notification surface is open.

void setIsOpen(bool open)

Whether the popup, drawer, or notification surface is open.

DrawerEdge edge() const

Window edge from which the drawer appears.

void setEdge(DrawerEdge edge)

Window edge from which the drawer appears.

qreal position() const

Animated drawer position along its opening axis.

void setPosition(qreal position)

Animated drawer position along its opening axis.

int drawerLength() const

Drawer length measured along the opening axis.

void setDrawerLength(int length)

Drawer length measured along the opening axis.

QMargins availableMargins() const

Margins removed from the owning window before drawer placement.

void setAvailableMargins(const QMargins& margins)

Margins removed from the owning window before drawer placement.

bool isModal() const

Whether the overlay blocks interaction outside itself.

void setModal(bool modal)

Whether the overlay blocks interaction outside itself.

bool isDim() const

Whether a dim/scrim layer is shown behind the overlay.

void setDim(bool dim)

Whether a dim/scrim layer is shown behind the overlay.

double dimOpacity() const

Scrim opacity in [0, 1]; -1 uses the theme smoke token when dim is enabled.

void setDimOpacity(double opacity)

Scrim opacity in [0, 1]; -1 uses the theme smoke token when dim is enabled.

double backdropBlurRadius() const

Cached owning-window blur radius in logical pixels [0, 32]; 0 disables blur.

void setBackdropBlurRadius(double radius)

Cached owning-window blur radius in logical pixels [0, 32]; 0 disables blur.

void refreshBackdrop()

Recaptures the owning-window content after background changes.

ClosePolicy closePolicy() const

Policy controlling outside-click, escape, or programmatic close behavior.

void setClosePolicy(ClosePolicy policy)

Policy controlling outside-click, escape, or programmatic close behavior.

bool isInteractive() const

Whether pointer dragging can interact with the drawer.

void setInteractive(bool interactive)

Whether pointer dragging can interact with the drawer.

int dragMargin() const

Edge margin used to begin drawer dragging.

void setDragMargin(int margin)

Edge margin used to begin drawer dragging.

int outerCornerRadius() const

Corner radius used on the drawer outer edge.

void setOuterCornerRadius(int radius)

Corner radius used on the drawer outer edge.

bool isAnimationEnabled() const

Whether drawer open/close transitions are animated.

void setAnimationEnabled(bool enabled)

Whether drawer open/close transitions are animated.

QWidget* contentWidget() const

Widget hosted inside the drawer panel.

void setContentWidget(QWidget* widget)

Hosts content with Borrowed release semantics.

bool setContentWidget(QWidget* widget, WidgetOwnership ownership)

Hosts content with an explicit release policy.

QWidget* takeContentWidget()

Removes and returns content as a parentless caller-owned widget.

WidgetOwnership contentOwnership() const

Release policy for the current content widget.

Signals

void isOpenChanged(bool open)

Whether the popup, drawer, or notification surface is open.

void edgeChanged(DrawerEdge edge)

Window edge from which the drawer appears.

void positionChanged(qreal position)

Animated drawer position along its opening axis.

void drawerLengthChanged(int length)

Drawer length measured along the opening axis.

void availableMarginsChanged(const QMargins& margins)

Margins removed from the owning window before drawer placement.

void modalChanged(bool modal)

Whether the overlay blocks interaction outside itself.

void dimChanged(bool dim)

Whether a dim/scrim layer is shown behind the overlay.

void dimOpacityChanged(double opacity)

Scrim opacity in [0, 1]; -1 uses the theme smoke token when dim is enabled.

void backdropBlurRadiusChanged(double radius)

Cached owning-window blur radius in logical pixels [0, 32]; 0 disables blur.

void closePolicyChanged(ClosePolicy policy)

Policy controlling outside-click, escape, or programmatic close behavior.

void interactiveChanged(bool interactive)

Whether pointer dragging can interact with the drawer.

void dragMarginChanged(int margin)

Edge margin used to begin drawer dragging.

void outerCornerRadiusChanged(int radius)

Corner radius used on the drawer outer edge.

void animationEnabledChanged(bool enabled)

Whether drawer open/close transitions are animated.

void contentWidgetChanged(QWidget* widget)

Widget hosted inside the drawer panel.

void contentOwnershipChanged(WidgetOwnership ownership)

Release policy for the current content widget.

Enumerations

enum class DrawerEdge
  • Left
  • Right
  • Top
  • Bottom
enum CloseFlag
  • NoAutoClose = 0
  • CloseOnPressOutside = 1 << 0
  • CloseOnEscape = 1 << 1

Types and aliases

Destructors

PySide6 additions

setOwnedContentWidget(widget)

Install content that is deleted when it leaves the drawer.

setBorrowedContentWidget(widget)

Install content that becomes parentless when released.

setReparentedContentWidget(widget)

Install content restored to its current QWidget parent.

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