QRadioButton Class
QRadioButton 위젯은 텍스트 레이블이 있는 라디오 버튼을 제공합니다. 더 보기...
헤더: | #include <QRadioButton> |
CMake: | find_package(Qt6 REQUIRED COMPONENTS Widgets) target_link_libraries(mytarget PRIVATE Qt6::Widgets) |
qmake: | QT += widgets |
상속합니다: | QAbstractButton |
공용 함수
QRadioButton(QWidget *parent = nullptr) | |
QRadioButton(const QString &text, QWidget *parent = nullptr) | |
virtual | ~QRadioButton() |
재구현된 공용 함수
virtual QSize | minimumSizeHint() const override |
virtual QSize | sizeHint() const override |
보호된 함수
virtual void | initStyleOption(QStyleOptionButton *option) const |
재구현된 보호 함수
virtual bool | event(QEvent *e) override |
virtual bool | hitButton(const QPoint &pos) const override |
virtual void | mouseMoveEvent(QMouseEvent *e) override |
virtual void | paintEvent(QPaintEvent *) override |
상세 설명
QRadioButton은 켜거나(체크) 끌 수 있는 옵션 버튼입니다(체크 해제). 라디오 버튼은 일반적으로 사용자에게 "여러 가지 중 하나"를 선택할 수 있습니다. 라디오 버튼 그룹에서는 한 번에 하나의 라디오 버튼만 선택할 수 있으며, 사용자가 다른 버튼을 선택하면 이전에 선택한 버튼이 꺼집니다.
라디오 버튼은 기본적으로 자동 독점 설정되어 있습니다. 자동 전용이 활성화된 경우 동일한 상위 위젯에 속한 라디오 버튼은 동일한 전용 버튼 그룹의 일부인 것처럼 작동합니다. 동일한 상위 위젯에 속하는 라디오 버튼에 여러 개의 전용 버튼 그룹이 필요한 경우 QButtonGroup 에 넣으면 됩니다.
버튼이 켜지거나 꺼질 때마다 toggled() 신호를 내보냅니다. 버튼의 상태가 변경될 때마다 동작을 트리거하려면 이 신호에 연결하세요. 특정 버튼이 선택되었는지 확인하려면 isChecked()를 사용합니다.
QPushButton 와 마찬가지로 라디오 버튼은 텍스트와 선택적으로 작은 아이콘을 표시합니다. 아이콘은 setIcon()로 설정합니다. 텍스트는 생성자에서 설정하거나 setText()로 설정할 수 있습니다. 텍스트 앞에 원하는 문자를 앰퍼샌드로 지정하여 바로 가기 키를 지정할 수 있습니다. 예를 들어
QRadioButton *button = new QRadioButton("Search from the &cursor", this);
이 예에서 바로 가기 키는 Alt+c입니다. 자세한 내용은 QShortcut 문서를 참조하세요. 실제 앰퍼샌드를 표시하려면 '&&'를 사용합니다.
중요한 상속 멤버: text(), setText(), text(), setDown(), isDown(), autoRepeat(), group(), setAutoRepeat(), toggle(), pressed(), released(), clicked() 및 toggled().
QPushButton, QToolButton, 및 QCheckBox 를참조하세요 .
멤버 함수 문서
[explicit]
QRadioButton::QRadioButton(QWidget *parent = nullptr)
주어진 parent 으로 텍스트나 픽셀맵이 없는 라디오 버튼을 생성합니다.
parent 인수는 QAbstractButton 생성자에게 전달됩니다.
[explicit]
QRadioButton::QRadioButton(const QString &text, QWidget *parent = nullptr)
주어진 parent 및 text 문자열로 라디오 버튼을 생성합니다.
parent 인수는 QAbstractButton 생성자에게 전달됩니다.
[virtual noexcept]
QRadioButton::~QRadioButton()
파괴자.
[override virtual protected]
bool QRadioButton::event(QEvent *e)
다시 구현합니다: QAbstractButton::event(QEvent *e).
[override virtual protected]
bool QRadioButton::hitButton(const QPoint &pos) const
재구현합니다: QAbstractButton::hitButton(const QPoint &pos) const.
[virtual protected]
void QRadioButton::initStyleOption(QStyleOptionButton *option) const
QRadioButton 의 값으로 option 을 초기화합니다. 이 메서드는 하위 클래스에 QStyleOptionButton 이 필요하지만 모든 정보를 직접 채우고 싶지 않을 때 유용합니다.
QStyleOption::initFrom()도 참조하세요 .
[override virtual]
QSize QRadioButton::minimumSizeHint() const
속성에 대한 액세스 함수를 다시 구현합니다: QWidget::minimumSizeHint.
[override virtual protected]
void QRadioButton::mouseMoveEvent(QMouseEvent *e)
다시 구현합니다: QAbstractButton::mouseMoveEvent(QMouseEvent *e).
[override virtual protected]
void QRadioButton::paintEvent(QPaintEvent *)
다시 구현합니다: QAbstractButton::paintEvent(QPaintEvent *e).
[override virtual]
QSize QRadioButton::sizeHint() const
속성에 대한 액세스 함수를 다시 구현합니다: QWidget::sizeHint.
© 2025 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.