跳转至

example/gui/theme/RadiusScalePage.h

Radius Scale page for the Material Gallery. More...

Namespaces

Name
cf
cf::ui
cf::ui::core
cf::ui::gallery

Classes

Name
class cf::ui::gallery::RadiusPreviewWidget
圆角预览卡片 - 显示一个带圆角的矩形
class cf::ui::gallery::RadiusScalePage
Radius Scale page - displays all 7 Material Design 3 corner radius levels.

Detailed Description

Radius Scale page for the Material Gallery.

Author: CFDesktop Team

Version: 0.1

Date: 2026-02-28

Source code

#pragma once

#include "ThemePageWidget.h"
#include "ui/core/material/cfmaterial_radius_scale.h"
#include <QGridLayout>
#include <QScrollArea>
#include <QVBoxLayout>

namespace cf::ui::core {
struct ICFTheme;
}

namespace cf::ui::gallery {

class RadiusPreviewWidget : public QWidget {
    Q_OBJECT
  public:
    explicit RadiusPreviewWidget(const QString& name, float radiusDp, const QColor& accentColor,
                                 QWidget* parent = nullptr);

  protected:
    void paintEvent(QPaintEvent* event) override;

  private:
    QString name_;
    float radiusDp_;
    QColor accentColor_;
};

class RadiusScalePage : public ThemePageWidget {
    Q_OBJECT

  public:
    explicit RadiusScalePage(QWidget* parent = nullptr);
    ~RadiusScalePage() override = default;

    QString pageTitle() const override { return "圆角规范"; }
    void applyTheme(const cf::ui::core::ICFTheme& theme) override;

  private:
    void setupUI();
    void createRadiusCards();

  private:
    const cf::ui::core::ICFTheme* theme_ = nullptr;

    // UI components
    QScrollArea* scrollArea_;
    QWidget* scrollContent_;
    QGridLayout* cardsLayout_;

    // Theme colors
    QColor cardBgColor_;
    QColor cardBorderColor_;
    QColor textColor_;
};

} // namespace cf::ui::gallery

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