40 lines
959 B
Python
40 lines
959 B
Python
# -*- coding: utf-8 -*-
|
|
"""
|
|
선택(Choice) 칩
|
|
- 다중선택: checkable=True 로 토글
|
|
- 단일선택: QButtonGroup(외부에서)으로 exclusive=True 처리
|
|
"""
|
|
|
|
from __future__ import annotations
|
|
|
|
from ui.components.chips.chip_base_button import ChipBaseButton, ChipTheme
|
|
|
|
|
|
class ChoiceChipButton(ChipBaseButton):
|
|
"""
|
|
선택용 칩 버튼
|
|
- 다중선택: checkable=True로 토글 가능
|
|
- 단일선택: QButtonGroup으로 exclusive 처리
|
|
"""
|
|
|
|
def __init__(
|
|
self,
|
|
text: str,
|
|
key: str,
|
|
bg: str = "#334155",
|
|
fg: str = "#ffffff",
|
|
theme: ChipTheme = ChipTheme(),
|
|
parent=None,
|
|
):
|
|
super().__init__(
|
|
text=text,
|
|
key=key,
|
|
bg=bg,
|
|
fg=fg,
|
|
theme=theme,
|
|
checkable=True, # 핵심: 선택 가능하게 설정
|
|
parent=parent,
|
|
)
|
|
self.setToolTip("클릭하여 선택/해제")
|
|
|