-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbutton.cpp
50 lines (44 loc) · 1.01 KB
/
button.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
#include <QtGui>
#include "button.h"
Button::Button(const QString &text, QWidget *parent)
: QToolButton(parent)
{
setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Preferred);
setText(text);
}
QSize Button::sizeHint() const
{
QSize size = QToolButton::sizeHint();
size.rheight() += 20;
size.rwidth() = qMax(size.width(), size.height());
return size;
}
void Button::setExp(int v)
{
Exp = v;
}
int Button::getExp()
{
return Exp;
}
radioButton::radioButton(const QString &text, QWidget *parent)
: QRadioButton(parent)
{
setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Preferred);
setText(text);
if (text == "Hex") NUM_TYPE = 16;
if (text == "Dec") NUM_TYPE = 10;
if (text == "Oct") NUM_TYPE = 8;
if (text == "Bin") NUM_TYPE = 2;
}
QSize radioButton::sizeHint() const
{
QSize size = QRadioButton::sizeHint();
size.rheight() += 20;
size.rwidth() = qMax(size.width(), size.height());
return size;
}
int radioButton::getNumeral()
{
return NUM_TYPE;
}