DAChip¶
DAChip is a closable tag/pill widget composed of a QFrame + label + close button. It supports qss styling and can be used independently.
Preview¶

Exported by --export-gallery: the first row is a non-closable read-only chip, the second is a chip with an × close button. Corner radius, background, and text color are all customizable through the DA--DAChip selector.
Key Features¶
- ✅ Closable: Built-in close button that emits
closeRequestedon click - ✅ qss customizable: Selector
DA--DAChip, sub-controls locatable by objectName - ✅ Independently usable: Can be used without DAChipsEdit
- ✅ Click signal: Supports click interaction
- ✅ Long-text elision (optional):
setElideWidth()caps the width,…+ tooltip shows the full text
Usage¶
1. Basic Usage¶
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | |
2. qss Styling¶
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 | |
3. Usage Inside DAChipsEdit¶
DAChipsEdit automatically creates and manages DAChip instances internally, so manual creation is usually unnecessary:
1 2 | |
4. Long-Text Elision (setElideWidth)¶
1 2 | |
The chip is capped at 96 px; the overflow ends with … and the full text is shown in a tooltip. text() and textChanged() always carry the full text. While elision is enabled the widget owns the tooltip (overriding any caller-set tooltip) and restores caller control when disabled. Keep the width at 64 px or more, otherwise the close button gets squeezed.
Sub-control Selectors
The close button uses objectName DAChipCloseButton and the label uses DAChipLabel. These can be targeted in qss for fine-grained styling.
Core Properties & Methods¶
| Property / Method | Type | Description |
|---|---|---|
text / setText() |
QString |
Tag text |
closable / setClosable() |
bool |
Whether to show the close button |
elideWidth / setElideWidth() |
int |
Maximum width in px; 0 = no elision |
Signals¶
| Signal | Description |
|---|---|
closeRequested() |
Close button was clicked |
clicked() |
Tag was clicked |
textChanged(QString) |
Text changed |
closableChanged(bool) |
closable property changed |