Skip to main content

QCustomMultiSelect

QCustomMultiSelect

A multiple-choice field with chips.

A closed field that paints the current selection as removable chips, and a checkable popup list to change it. QComboBox cannot do this: it is single-selection by design, and the usual workaround (a QComboBox with checkable model items) leaves the closed field showing one entry while the model holds several.

Options are authored in code with setOptions([...]) or in Qt Designer with the optionsCsv property, following the valuesCsv convention used elsewhere:

optionsCsv = "Red,Green,Blue" labels double as values optionsCsv = "r=Red,g=Green,b=Blue" explicit value=label

Emits selectionChanged(list) and optionToggled(str, bool).

At a glance

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

Quick start

from Custom_Widgets.QCustomMultiSelect import QCustomMultiSelect

widget = QCustomMultiSelect()

Dark theme

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

QCustomMultiSelect in dark theme

Properties

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

PropertyTypeDefault
optionsCsvstringOption one,Option two,Option three
selectedCsvstring
placeholderTextstringSelect...
maxChipsint0
maxSelectionint0
searchableboolFalse
sizeVariantenum: sm/md/lg``md
stateenum: default/error``default
fieldBackgroundColorcolor
fieldBorderColorcolor
fieldBorderActiveColorcolor
fieldBorderErrorColorcolor
chipBackgroundColorcolor
chipTextColorcolor
textColorcolor
placeholderColorcolor

Signals

Signal
optionToggled(QString,bool)
selectionChanged(QVariantList)

Methods

MethodDescription
chipBackgroundColor(*args, **kwargs)Chip background color.
chipTextColor(*args, **kwargs)Chip text color.
clearSelection()Clear the selection.
count()Count.
fieldBackgroundColor(*args, **kwargs)Field background color.
fieldBorderActiveColor(*args, **kwargs)Field border active color.
fieldBorderColor(*args, **kwargs)Field border color.
fieldBorderErrorColor(*args, **kwargs)Field border error color.
hidePopup()Hide the popup.
isPopupVisible()Return whether the widget is popup visible.
isSelected(value)Return whether the widget is selected.
labelFor(value)Label for.
maxChips(*args, **kwargs)Max chips.
maxSelection(*args, **kwargs)Max selection.
optionToggled(...)Option toggled.
options()Options.
optionsCsv(*args, **kwargs)Options csv.
placeholderColor(*args, **kwargs)Placeholder color.
placeholderText(*args, **kwargs)Placeholder text.
searchable(*args, **kwargs)Searchable.
selectOption(value, on=True)Select an option.
selected()Selected.
selectedCsv(*args, **kwargs)Selected csv.
selectedLabels()Selected labels.
selectionChanged(...)Selection changed.
setOptions(options)Replace the option set, dropping any selection that no longer exists.
setSelected(values)Set the selected.
showPopup()Show the popup.
sizeVariant(*args, **kwargs)Size variant.
state(*args, **kwargs)State.
textColor(*args, **kwargs)Text color.
toggleOption(value)Toggle the option.

Theming

Colours come from the design tokens, so they follow the active theme. Roles used: surface, on-surface, outline, focus-ring, accent, destructive.

See Design tokens.

Runnable example

A complete app using this widget lives at examples/PySide6/QCustomMultiSelect/main.py.

QCustomButtonGroup · QCustomCheckBox · QCustomColorPicker · QCustomComboBox · QCustomDateEdit · QCustomDateRangePicker · QCustomEmojiPicker · QCustomFileDropZone