跳转至

ui/base/geometry_helper.h

Geometry helpers for creating rounded rectangles. More...

Namespaces

Name
cf
cf::ui
cf::ui::base
cf::ui::base::geometry

Detailed Description

Geometry helpers for creating rounded rectangles.

Author: Charliechen114514

Version: 0.1

Since: 0.1

Date: 2026-02-23

Provides utilities for creating rounded rectangles with various corner radius options following Material Design shape scales.

Source code

#pragma once
#include <QPainterPath>

namespace cf::ui::base {
namespace geometry {

enum class ShapeScale {
    ShapeNone,       
    ShapeExtraSmall, 
    ShapeSmall,      
    ShapeMedium,     
    ShapeLarge,      
    ShapeExtraLarge, 
    ShapeFull        
};

QPainterPath roundedRect(const QRectF& rect, ShapeScale scale);

QPainterPath roundedRect(const QRectF& rect, float radius);

QPainterPath roundedRect(const QRectF& rect, float topLeft, float topRight, float bottomLeft,
                         float bottomRight);

} // namespace geometry
} // namespace cf::ui::base

Updated on 2026-03-09 at 10:14:01 +0000