Skip to main content

QCustomModal

QCustomModal

A modern centered modal dialog with a dim backdrop.

Overlays its parent window with a translucent scrim and a centered rounded card (title + close, a content slot, and action buttons). Click the scrim or the close button, or press Esc, to dismiss. Show it with showModal(); it animates in. Emits triggered(key) for action buttons and closed() on dismiss. Theme from code with applyColors(...).

m = QCustomModal(mainWindow) m.setTitle("Send money"); m.addContent(myForm) m.addAction("Cancel", "cancel"); m.addAction("Send", "send", primary=True) m.triggered.connect(handler); m.showModal()

At a glance

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

Quick start

from Custom_Widgets.QCustomModal import QCustomModal

widget = QCustomModal()

Dark theme

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

QCustomModal in dark theme

Signals

Signal
closed()
triggered(QString)

Methods

MethodDescription
addAction(text, key=None, primary=False, danger=False)Add an action.
addContent(widget)Add a content.
applyColors(bg=None, text=None, muted=None, border=None, accent=None, accentText=None, hover=None)Apply the colors.
clearActions()Clear the actions.
clearContent()Clear the content.
closeModal()Close the modal.
closed(...)Closed.
eventFilter(obj, ev)Event filter.
setSubtitle(text)Set the subtitle.
setTitle(text)Set the title.
showModal()Show the modal.
triggered(...)Triggered.

Theming

Colours come from the design tokens, so they follow the active theme. Roles used: accent, background, text.

See Design tokens.

QCustomAccordion · QCustomCardStack · QCustomCarousel · QCustomEmbeddedWindow · QCustomFlowLayout · QCustomFlowWidget · QCustomGlassFrame · QCustomPopover