Skip to main content

QCustomGlassFrame

QCustomGlassFrame

A GLASSMORPHISM / "liquid glass" container.

A rounded container that composites a BLURRED copy of the content behind it (the app's backdrop photo / wallpaper widget), then layers a tint, a film-grain noise pass, a hairline border and - opt-in - a "liquid" edge (refraction ring + specular rim) on top. Children laid out inside it sit on frosted glass, like CSS backdrop-filter or visionOS panels.

Qt has no native backdrop-filter, so the frame renders a SOURCE widget into a pixmap, blurs it offscreen (downsample -> QGraphicsBlurEffect -> upsample) and paints that region under its own content:

  • backdropSource (objectName) / setBackdropWidget(w): the widget to sample - typically the full-window photo QLabel BELOW the glass panels. Sampling a widget that does not contain the frame is cheap and flicker-free, so liveBackdrop can re-sample continuously.
  • With no source set, the frame samples its own top-level window (hiding itself for the grab). That path is for static backdrops - refresh happens on show/resize/move or an explicit refreshBackdrop().
  • With nothing to sample (Designer palette preview, render_widget), it paints a seeded placeholder gradient so it still previews.

Every knob is a typed Designer property; colours are qproperties so QSS drives them per theme (qproperty-tintColor: ...). The live re-sampling "animation" is user-controllable via liveBackdrop + refreshInterval.

At a glance​

TierFree (GPLv3)
Importfrom Custom_Widgets.QCustomGlassFrame import QCustomGlassFrame
Qt DesignerYes — drag it from the palette

Quick start​

from Custom_Widgets.QCustomGlassFrame import QCustomGlassFrame

widget = QCustomGlassFrame()

Dark theme​

Colours come from the design tokens, so the widget follows the app theme with no extra work.

QCustomGlassFrame in dark theme

Properties​

Every property below is settable in code and in Qt Designer.

PropertyTypeDefault
frameShapeQFrame::Shape—
frameShadowQFrame::Shadow—
lineWidthint—
midLineWidthint—
frameWidthint—
frameRectQRect—
backdropSourcestring—
blurRadiusint28
downsampleint3
tintColorcolorrgba(18,22,32,110)
brightnessfloat1.0
noiseOpacityfloat0.05
cornerRadiusint24
borderColorcolorrgba(255,255,255,55)
borderWidthfloat1.0
liquidEdgeboolFalse
edgeIntensityfloat0.5
liveBackdropboolFalse
refreshIntervalint120

Methods​

MethodDescription
backdropSource(*args, **kwargs)Backdrop source.
blurRadius(*args, **kwargs)Blur radius.
borderColor(*args, **kwargs)Border color.
borderWidth(*args, **kwargs)Border width.
brightness(*args, **kwargs)Brightness.
changeEvent(e)Change event.
cornerRadius(*args, **kwargs)Corner radius.
downsample(*args, **kwargs)Downsample.
edgeIntensity(*args, **kwargs)Edge intensity.
eventFilter(obj, e)Event filter.
liquidEdge(*args, **kwargs)Liquid edge.
liveBackdrop(*args, **kwargs)Live backdrop.
moveEvent(e)Move event.
noiseOpacity(*args, **kwargs)Noise opacity.
refreshBackdrop()Re-sample and re-blur the backdrop now.
refreshInterval(*args, **kwargs)Refresh the interval.
setBackdropWidget(widget)Point the frame at the widget to sample (overrides backdropSource).
tintColor(*args, **kwargs)Tint color.

QCustomAccordion · QCustomCardStack · QCustomCarousel · QCustomComponent · QCustomComponentContainer · QCustomComponentLoader · QCustomEmbeddedWindow · QCustomFlowLayout