This repository has been archived by the owner on Mar 8, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy paththrowcontrolpanel.cpp
65 lines (47 loc) · 1.96 KB
/
throwcontrolpanel.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
54
55
56
57
58
59
60
61
62
63
64
65
#include "throwcontrolpanel.h"
#include <QtGui>
ThrowControlPanel::ThrowControlPanel(QWidget *parent) :
QWidget(parent)
{
hRadio = new QRadioButton(tr("Wysokość"));
tRadio = new QRadioButton(tr("Czas"));
vRadio = new QRadioButton(tr("Prędkość"));
sRadio = new QRadioButton(tr("Zasięg"));
valBoxOne = new QDoubleSpinBox();
valBoxTwo = new QDoubleSpinBox();
button= new QPushButton(tr("Rzuć!"));
QVBoxLayout * layout = new QVBoxLayout();
layout->addWidget(createGroupBox(hRadio,tRadio,valBoxOne,20.0));
layout->addWidget(createGroupBox(vRadio,sRadio,valBoxTwo,15.0));
layout->addWidget(createComboBox());
layout->addWidget(button);
connect(button,SIGNAL(clicked()),this,SIGNAL(throwRequested()));
setLayout(layout);
}
QGroupBox * ThrowControlPanel::createGroupBox(QRadioButton * radioA, QRadioButton * radioB, QDoubleSpinBox * spinBox, double spinBoxVal)
{
QGroupBox *groupBox = new QGroupBox();
spinBox->setValue(spinBoxVal);
radioA->setChecked(true);
QGridLayout * grid = new QGridLayout();
grid->addWidget(radioA,0,0);
grid->addWidget(radioB,0,1);
grid->addWidget(spinBox,1,0,1,2);
groupBox->setLayout(grid);
return groupBox;
}
QGroupBox * ThrowControlPanel::createComboBox()
{
this->gravBox = new QComboBox();
QGroupBox *groupBox = new QGroupBox(tr("Wartość przyspieszenia ziemskiego:"));
gravBox->addItem(tr("Normalne (%1)").arg(GravAcc::NORM),GravAcc::NORM);
gravBox->addItem(tr("Biegun (%1)").arg(GravAcc::POLE),GravAcc::POLE);
gravBox->addItem(tr("Równik (%1)").arg(GravAcc::EQUATOR), GravAcc::EQUATOR);
gravBox->addItem(tr("Kraków (%1)").arg(GravAcc::KRA),GravAcc::KRA);
gravBox->addItem(tr("Gdańsk (%1)").arg(GravAcc::GDA),GravAcc::GDA);
gravBox->addItem(tr("Warszawa (%1)").arg(GravAcc::WWA),GravAcc::WWA);
QHBoxLayout * layout = new QHBoxLayout();
layout->addWidget(gravBox);
groupBox->setLayout(layout);
return groupBox;
}