量化交易之QT篇 - TQZLabel - 自定义QLabel

阅读 89

2023-04-22


// TQZLabel.h

#ifndef TQZLABEL_H
#define TQZLABEL_H

#include <QLabel>

class TQZLabel : public QLabel
{
    Q_OBJECT
public:
    explicit TQZLabel(const QString &text, QWidget *parent = nullptr);

signals:

};

#endif // TQZLABEL_H

// TQZLabel.cpp

#include "TQZLabel.h"

TQZLabel::TQZLabel(const QString &text, QWidget *parent) : QLabel(text, parent)
{
//    this->setStyleSheet("background-color: blue; color: white; font-size: 18px;");
    this->setStyleSheet("color: white; font-size: 18px;");

    QFont font("宋体", 15, QFont::Medium);
    this->setFont(font);
}

精彩评论(0)

0 0 举报