#include <QtGui>
#include "window.h"
Window::Window()
{
createControls(tr("Controls"));
connect(minimumSpinBoxJ1, SIGNAL(valueChanged(int)), this, SLOT(setMinimum1(int)));
connect(maximumSpinBoxJ1, SIGNAL(valueChanged(int)), this, SLOT(setMaximum1(int)));
connect(minimumSpinBoxJ2, SIGNAL(valueChanged(int)), this, SLOT(setMinimum2(int)));
connect(maximumSpinBoxJ2, SIGNAL(valueChanged(int)), this, SLOT(setMaximum2(int)));
mainLayout->addWidget(controlsGroup,1,0);
mainLayout->addWidget(sizesGroup,2,0);
mainLayout->addWidget(coinWidget,0,0,1,0);
setLayout(mainLayout);
minimumSpinBoxJ1->setValue(0);
maximumSpinBoxJ1->setValue(0);
valueSpinBoxJ1->setValue(0);
minimumSpinBoxJ2->setValue(0);
maximumSpinBoxJ2->setValue(0);
valueSpinBoxJ2->setValue(0);
}
void Window
::createControls(const QString &title
) {
controlsGroup->setAlignment(Qt::AlignCenter);
J1->setAlignment(Qt::AlignCenter);
J2->setAlignment(Qt::AlignCenter);
minimumLabel
= new QLabel(tr
("Angle - minimum value:"));
maximumLabel
= new QLabel(tr
("Angle - maximum value:"));
valueLabel
= new QLabel (tr
("Angle - current value:"));
minimumSpinBoxJ1->setRange(-500,500);
minimumSpinBoxJ1->setSingleStep(1);
maximumSpinBoxJ1->setRange(-500,500);
maximumSpinBoxJ1->setSingleStep(1);
valueSpinBoxJ1->setSingleStep(1);
minimumSpinBoxJ2->setRange(-500,500);
minimumSpinBoxJ2->setSingleStep(1);
maximumSpinBoxJ2->setRange(-500,500);
maximumSpinBoxJ2->setSingleStep(1);
valueSpinBoxJ2->setSingleStep(1);
connect(valueSpinBoxJ1,SIGNAL(valueChanged(int)),lcd1,SLOT(display(int)));
connect(valueSpinBoxJ2,SIGNAL(valueChanged(int)),lcd2,SLOT(display(int)));
controlsLayout->addWidget(J1,1,1);
controlsLayout->addWidget(J2,1,2);
controlsLayout->addWidget(lcd1,5,1);
controlsLayout->addWidget(lcd2,5,2);
controlsLayout->addWidget(minimumLabel, 2, 0);
controlsLayout->addWidget(maximumLabel, 3, 0);
controlsLayout->addWidget(valueLabel, 4, 0);
controlsLayout->addWidget(minimumSpinBoxJ1, 2, 1);
controlsLayout->addWidget(maximumSpinBoxJ1, 3, 1);
controlsLayout->addWidget(valueSpinBoxJ1, 4, 1);
controlsLayout->addWidget(minimumSpinBoxJ2, 2, 2);
controlsLayout->addWidget(maximumSpinBoxJ2, 3, 2);
controlsLayout->addWidget(valueSpinBoxJ2, 4, 2);
controlsGroup->setLayout(controlsLayout);
}
void Window::setMinimum1(int value)
{
valueSpinBoxJ1->setMinimum(value);
}
void Window::setMaximum1(int value)
{
valueSpinBoxJ1->setMaximum(value);
}
void Window::setMinimum2(int value)
{
valueSpinBoxJ2->setMinimum(value);
}
void Window::setMaximum2(int value)
{
valueSpinBoxJ2->setMaximum(value);
}
#include <QtGui>
#include "window.h"
Window::Window()
{
createControls(tr("Controls"));
connect(minimumSpinBoxJ1, SIGNAL(valueChanged(int)), this, SLOT(setMinimum1(int)));
connect(maximumSpinBoxJ1, SIGNAL(valueChanged(int)), this, SLOT(setMaximum1(int)));
connect(minimumSpinBoxJ2, SIGNAL(valueChanged(int)), this, SLOT(setMinimum2(int)));
connect(maximumSpinBoxJ2, SIGNAL(valueChanged(int)), this, SLOT(setMaximum2(int)));
QGridLayout *mainLayout = new QGridLayout;
mainLayout->addWidget(controlsGroup,1,0);
mainLayout->addWidget(sizesGroup,2,0);
mainLayout->addWidget(coinWidget,0,0,1,0);
setLayout(mainLayout);
minimumSpinBoxJ1->setValue(0);
maximumSpinBoxJ1->setValue(0);
valueSpinBoxJ1->setValue(0);
minimumSpinBoxJ2->setValue(0);
maximumSpinBoxJ2->setValue(0);
valueSpinBoxJ2->setValue(0);
}
void Window::createControls(const QString &title)
{
controlsGroup = new QGroupBox(title);
controlsGroup->setAlignment(Qt::AlignCenter);
J1 = new QLabel(tr("J1"));
J1->setAlignment(Qt::AlignCenter);
J2 = new QLabel(tr("J2"));
J2->setAlignment(Qt::AlignCenter);
minimumLabel = new QLabel(tr("Angle - minimum value:"));
maximumLabel = new QLabel(tr("Angle - maximum value:"));
valueLabel = new QLabel (tr("Angle - current value:"));
minimumSpinBoxJ1 = new QSpinBox;
minimumSpinBoxJ1->setRange(-500,500);
minimumSpinBoxJ1->setSingleStep(1);
maximumSpinBoxJ1 = new QSpinBox;
maximumSpinBoxJ1->setRange(-500,500);
maximumSpinBoxJ1->setSingleStep(1);
valueSpinBoxJ1 = new QSpinBox;
valueSpinBoxJ1->setSingleStep(1);
minimumSpinBoxJ2 = new QSpinBox;
minimumSpinBoxJ2->setRange(-500,500);
minimumSpinBoxJ2->setSingleStep(1);
maximumSpinBoxJ2 = new QSpinBox;
maximumSpinBoxJ2->setRange(-500,500);
maximumSpinBoxJ2->setSingleStep(1);
valueSpinBoxJ2 = new QSpinBox;
valueSpinBoxJ2->setSingleStep(1);
QLCDNumber *lcd1 = new QLCDNumber(3);
lcd1->setSegmentStyle(QLCDNumber::Flat);
QLCDNumber *lcd2 = new QLCDNumber(4);
lcd2->setSegmentStyle(QLCDNumber::Flat);
QLCDNumber *lcd3 = new QLCDNumber(4);
connect(valueSpinBoxJ1,SIGNAL(valueChanged(int)),lcd1,SLOT(display(int)));
connect(valueSpinBoxJ2,SIGNAL(valueChanged(int)),lcd2,SLOT(display(int)));
QGridLayout *controlsLayout = new QGridLayout;
controlsLayout->addWidget(J1,1,1);
controlsLayout->addWidget(J2,1,2);
controlsLayout->addWidget(lcd1,5,1);
controlsLayout->addWidget(lcd2,5,2);
controlsLayout->addWidget(minimumLabel, 2, 0);
controlsLayout->addWidget(maximumLabel, 3, 0);
controlsLayout->addWidget(valueLabel, 4, 0);
controlsLayout->addWidget(minimumSpinBoxJ1, 2, 1);
controlsLayout->addWidget(maximumSpinBoxJ1, 3, 1);
controlsLayout->addWidget(valueSpinBoxJ1, 4, 1);
controlsLayout->addWidget(minimumSpinBoxJ2, 2, 2);
controlsLayout->addWidget(maximumSpinBoxJ2, 3, 2);
controlsLayout->addWidget(valueSpinBoxJ2, 4, 2);
controlsGroup->setLayout(controlsLayout);
}
void Window::setMinimum1(int value)
{
valueSpinBoxJ1->setMinimum(value);
}
void Window::setMaximum1(int value)
{
valueSpinBoxJ1->setMaximum(value);
}
void Window::setMinimum2(int value)
{
valueSpinBoxJ2->setMinimum(value);
}
void Window::setMaximum2(int value)
{
valueSpinBoxJ2->setMaximum(value);
}
To copy to clipboard, switch view to plain text mode
Bookmarks