//
// Created by Krad on 2022/1/11.
//

#include <QtWidgets/qstyleoption.h>
#include <QPaintEvent>
#include <QStylePainter>
#include "VerticalTextToolButton.h"

VerticalTextToolButton::VerticalTextToolButton(QWidget *parent) : QToolButton(parent) {

}

VerticalTextToolButton::~VerticalTextToolButton() {

}

void VerticalTextToolButton::paintEvent(QPaintEvent *e) {
    QToolButton::paintEvent(e);
    QStylePainter p(this);
    QStyleOptionToolButton opt;
    initStyleOption(&opt);
    p.rotate(90);
    p.drawText(this->iconSize().height()+10,-this->iconSize().height()/2+1,this->verticalText);
//    p.drawItemText( r,alignment,opt.palette,true,this->verticalText,QPalette::ButtonText);
}
