Menu

[r83]: / trunk / VertLabel.cpp  Maximize  Restore  History

Download this file

32 lines (24 with data), 581 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
#include "VertLabel.h"
VertLabel::VertLabel(QString txt, QWidget *parent): QLabel(parent)
{
text = txt;
QFont font("sans",24);
QFontMetrics fm(font);
int pixelsWide = fm.width(txt);
int pixelsHigh = fm.height();
this->resize(pixelsHigh,pixelsWide);
}
void VertLabel::paintEvent(QPaintEvent *)
{
QFont font("sans",24);
QPainter painter(this);
painter.setFont(font);
painter.setPen(Qt::gray);
painter.rotate(90);
painter.drawText(QPoint(0,-10), text);
}
void VertLabel::changeText(QString txt)
{
text = txt;
update();
}
Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.