35 lines
813 B
C++
Executable File
35 lines
813 B
C++
Executable File
#ifndef MYLABEL_H
|
|
#define MYLABEL_H
|
|
|
|
#include <QLabel>
|
|
#include <QRect>
|
|
|
|
class MyLabel : public QLabel
|
|
{
|
|
Q_OBJECT
|
|
public:
|
|
MyLabel(QWidget* parent = nullptr);
|
|
MyLabel(const QString& text, QWidget* parent = nullptr, QColor color = QColor(0xCC, 0xCC, 0xCC));
|
|
virtual ~MyLabel();
|
|
|
|
void setDeplayText(const QString& text) { m_text = text; QLabel::setText(text);}
|
|
void setFontColor(QColor color);
|
|
void setFontSize(int size);
|
|
void setFontWordWrap(bool on);
|
|
void setIsOriginal(bool isOriginal) { m_isOriginal = isOriginal; }
|
|
|
|
protected:
|
|
void paintEvent(QPaintEvent *event);
|
|
|
|
private:
|
|
QString m_text;
|
|
bool m_bWordWrap = false;
|
|
int m_width = 0;
|
|
int m_height = 0;
|
|
bool m_isOriginal = false;
|
|
bool m_needResize = false;
|
|
QRect m_rect;
|
|
};
|
|
|
|
#endif // MYLABEL_H
|