-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathverticalButton.cpp
53 lines (45 loc) · 1.05 KB
/
verticalButton.cpp
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
41
42
43
44
45
46
47
48
49
50
51
52
53
#include "verticalButton.h"
#include <QStylePainter>
/*!
\brief Vychozi konsturktor
*/
VerticalButton::VerticalButton(QWidget* parent)
: QPushButton(parent)
{
_orientation = Qt::Vertical;
}
/*!
\brief Konstruktor s moznosti definice popisku tlacitka
*/
VerticalButton::VerticalButton(const QString& text, QWidget* parent)
: QPushButton(text, parent)
{
_orientation = Qt::Vertical;
}
/*!
\brief Nastaveni velikosti tlacitka
*/
QSize VerticalButton::minimumSizeHint() const
{
QSize size = QPushButton::minimumSizeHint();
size.transpose();
return size;
}
/*!
\brief Vykresleni tlacitka
*/
void VerticalButton::paintEvent(QPaintEvent* event)
{
Q_UNUSED(event);
QStylePainter painter(this);
QStyleOptionButton options;
painter.rotate(-90);
painter.translate(-height(), 0);
options.initFrom(this);
QSize size = options.rect.size();
size.transpose();
options.rect.setSize(size);
options.features = QStyleOptionButton::None;
options.text = text();
painter.drawControl(QStyle::CE_PushButton, options);
}