-
Notifications
You must be signed in to change notification settings - Fork 23
Expand file tree
/
Copy pathverticallabel.cpp
More file actions
40 lines (31 loc) · 881 Bytes
/
Copy pathverticallabel.cpp
File metadata and controls
40 lines (31 loc) · 881 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
#include "verticallabel.h"
#include <QPainter>
VerticalLabel::VerticalLabel(QWidget *parent)
: QLabel(parent)
{
}
VerticalLabel::VerticalLabel(const QString &text, QWidget *parent)
: QLabel(text, parent)
{
}
void VerticalLabel::paintEvent(QPaintEvent*)
{
QPainter painter(this);
// painter.setPen(Qt::black);
// painter.setBrush(Qt::Dense1Pattern);
painter.translate(0,sizeHint().height());
painter.rotate(270);
painter.drawText(QRect (QPoint(0,0),QLabel::sizeHint()),Qt::AlignCenter,text());
// painter.rotate(90);
// painter.drawText(0,0, text());
}
QSize VerticalLabel::minimumSizeHint() const
{
QSize s = QLabel::minimumSizeHint();
return QSize(s.height(), s.width());
}
QSize VerticalLabel::sizeHint() const
{
QSize s = QLabel::sizeHint();
return QSize(s.height(), s.width());
}