#include "myframe.h"

MyFrame::MyFrame(QWidget *parent) : QFrame(parent)
{
    this->setObjectName("kylin-burner_MyFrame");
    setFrameShape(QFrame::Box);
    exframe = new kdk::KHLineFrame();
    exframe->setAccessibleName("kylin-burner_KHLineFrame_MyFrame_exframe");
}

void MyFrame::paintEvent(QPaintEvent *event)
{
    // 获取当前主题颜色
    QPalette palette = this->palette();
    QColor color = palette.color(QPalette::Window);

    QColor color1 = exframe->palette().color(QPalette::Window);

    // 设置画笔颜色为主题颜色
    QPainter painter(this);
    painter.setPen(QPen(color1, 1, Qt::DashLine, Qt::RoundCap, Qt::RoundJoin));

    // 绘制虚线框
    QRect rect = this->rect();
    rect.setWidth(rect.width() - 2);
    rect.setHeight(rect.height() - 2);
    painter.drawRoundedRect(rect, 6, 6);
}
