Skip to main content

QCustomPaymentCard

QCustomPaymentCard

A painted credit / debit card surface.

A rounded card with a brand mark, a big amount and a masked card number, drawn entirely with QPainter so it stays crisp at any size and needs no child widgets. Two looks: variant="gradient" (default) - a diagonal two-stop gradient (e.g. an accent "active" card) with light text. variant="flat" - a single flat fill (e.g. a muted secondary card) whose text colour you control. Colours come from qproperties so a theme/manager can tokenise them. An optional EMV-style chip can be shown. Set content with setBrand/setAmount/ setNumber (or the Designer properties).

At a glance​

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

Quick start​

from Custom_Widgets.QCustomPaymentCard import QCustomPaymentCard

widget = QCustomPaymentCard()

Dark theme​

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

QCustomPaymentCard in dark theme

Properties​

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

PropertyTypeDefault
brandstringVISA
amountstring$5 400.55
numberstring4558
variantenum: gradient/flat``gradient
gradientStartcolor#3f6bff
gradientEndcolor#1c33c4
flatColorcolor#e7e9f0
textColorcolor#ffffff
cornerRadiusint18
showChipboolFalse
fullNumberstring—
revealableboolFalse
revealedbool—

Signals​

Signal
numberRevealed(bool)

Methods​

MethodDescription
amount(*args, **kwargs)Amount.
brand(*args, **kwargs)Brand.
cornerRadius(*args, **kwargs)Corner radius.
flatColor(*args, **kwargs)Flat color.
fullNumber(*args, **kwargs)Full number.
gradientEnd(*args, **kwargs)Gradient end.
gradientStart(*args, **kwargs)Gradient start.
number(*args, **kwargs)Number.
numberRevealed(...)Number revealed.
revealable(*args, **kwargs)Revealable.
revealed(*args, **kwargs)Revealed.
setAmount(text)Set the amount.
setBrand(text)Set the brand.
setColors(start, end=None)Set the gradient (start, end) — or a single flat colour if end is None.
setFullNumber(number)The complete PAN — enables a real reveal (otherwise the eye just
setNumber(text)Set the number.
setRevealable(on)Set the revealable.
setRevealed(on)Set the revealed.
setVariant(variant)Set the variant.
showChip(*args, **kwargs)Show the chip.
textColor(*args, **kwargs)Text color.
toggleReveal()Toggle the reveal.
variant(*args, **kwargs)Variant.

QCustomAgendaList · QCustomAlert · QCustomAvatar · QCustomAvatarGroup · QCustomBadge · QCustomCard · QCustomChip · QCustomChipGroup