QCanvasBoxGradient Class
QCanvasBoxGradient는 상자 그라데이션 페인팅용 브러시입니다. 더 보기...
| Header: | #include <QCanvasBoxGradient> |
| CMake: | find_package(Qt6 REQUIRED COMPONENTS CanvasPainter)target_link_libraries(mytarget PRIVATE Qt6::CanvasPainter) |
| 이후 | Qt 6.11 |
| 상속합니다: | QCanvasGradient |
| Status: | 기술 미리보기 |
공용 함수
| QCanvasBoxGradient() | |
| QCanvasBoxGradient(const QRectF &rect, float feather, float radius = 0.0f) | |
| QCanvasBoxGradient(float x, float y, float width, float height, float feather, float radius = 0.0f) | |
| float | feather() const |
| float | radius() const |
| QRectF | rect() const |
| void | setFeather(float feather) |
| void | setRadius(float radius) |
| void | setRect(float x, float y, float width, float height) |
| void | setRect(const QRectF &rect) |
상세 설명
상자 그라데이션은 시작점과 끝점 사이의 색상을 보간하여 둥근 직사각형 모양의 그라데이션을 만듭니다. setRadius () 및 setFeather()를 사용하여 그라데이션의 둥근 정도와 부드러움을 제어할 수 있습니다.

다음은 간단한 예시입니다:
![]() | QRectF rect(20, 20, 160, 160); QCanvasBoxGradient bg(rect, 20, 50); bg.setColorAt(0.0, "#1a2a6c"); bg.setColorAt(0.2, "#fdbb2d"); bg.setColorAt(1.0, QColorConstants::Transparent); p->setFillStyle(bg); p->fillRect(rect); |
참고: 둥근 직사각형을 그리기 위해 QCanvasBoxGradient를 사용하는 경우 일반적으로 경로가 아닌 브러시에서 반올림되므로 QCanvasPainter::roundRect()보다 QCanvasPainter::rect()를 사용하는 것이 좋습니다. 이렇게 하면 버텍스가 추가로 생성되지 않으므로 성능이 향상됩니다.
멤버 함수 문서
QCanvasBoxGradient::QCanvasBoxGradient()
기본 상자 그라데이션을 만듭니다. 그라데이션의 위치는 (0, 0), 크기는 (100, 100) 그라데이션 페더는 10.0입니다. 그라데이션 반경은 0.0입니다. 그라데이션 시작 색상은 흰색(255, 255, 255)이고 끝 색상은 투명한 검정색(0, 0, 0, 0)입니다.
QCanvasBoxGradient::QCanvasBoxGradient(const QRectF &rect, float feather, float radius = 0.0f)
상자 그라데이션을 만듭니다. 그라데이션의 위치와 크기는 rect 입니다. 그라데이션 페더는 feather 입니다. 그라데이션 반경은 radius 입니다. 그라데이션 시작 색상은 흰색(255, 255, 255)이고 끝 색상은 투명한 검정색(0, 0, 0, 0)입니다.
QCanvasBoxGradient::QCanvasBoxGradient(float x, float y, float width, float height, float feather, float radius = 0.0f)
상자 그라데이션을 만듭니다. 그라데이션의 위치는 ( x, y) 및 크기 ( width, height) 그라데이션 페더는 feather 입니다. 그라데이션 반경은 radius 입니다. 그라데이션 시작 색상은 흰색(255, 255, 255)이고 끝 색상은 투명한 검정색(0, 0, 0, 0)입니다.
float QCanvasBoxGradient::feather() const
상자 그라데이션의 페더를 반환합니다.
setFeather()도 참조하세요 .
float QCanvasBoxGradient::radius() const
상자 그라데이션의 반지름을 반환합니다.
setRadius()도 참조하세요 .
QRectF QCanvasBoxGradient::rect() const
상자 그라데이션의 직사각형 영역을 반환합니다.
setRect()도 참조하세요 .
void QCanvasBoxGradient::setFeather(float feather)
상자 그라데이션의 페더를 feather 로 설정합니다.
feather()도 참조하세요 .
void QCanvasBoxGradient::setRadius(float radius)
상자 그라데이션의 반경을 radius 으로 설정합니다. 최대 반경은 너비 또는 높이 중 더 작은 쪽에 따라 rect()의 절반입니다.
radius()도 참조하세요 .
void QCanvasBoxGradient::setRect(float x, float y, float width, float height)
상자 그라데이션의 직사각형을 위치( x, y) 및 크기( width, height)로 설정합니다.
rect()도 참조하세요 .
void QCanvasBoxGradient::setRect(const QRectF &rect)
상자 그라데이션의 직사각형을 rect 로 설정합니다.
이것은 오버로드된 함수입니다.
© 2026 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.
