#include "mytabwidget.h"
#include <QStyleOption>
#include <QPainter>
#include <QBitmap>

MyTabWidget::MyTabWidget(QWidget *parent) : QTabWidget(parent)
{


}

void MyTabWidget::paintEvent(QPaintEvent *p1)
{
    //绘制样式
    QStyleOption opt;
    opt.initFrom(this);
    QPainter p(this);
    style()->drawPrimitive(QStyle::PE_Widget, &opt, &p, this);//绘制样式

    QBitmap bmp(this->size());
    bmp.fill();
    QPainter painter(&bmp);
    painter.setPen(Qt::NoPen);
    painter.setBrush(Qt::black);
    painter.setRenderHint(QPainter::Antialiasing);
    painter.drawRoundedRect(bmp.rect(), 12, 12);
    setMask(bmp);
}
