void FlowThread::setScale(float scale, bool initScale) { for (size_t i = 0; i < _joints.size(); i++) { auto &joint = _jointsPointer->at(_joints[i]); joint.setScale(scale, initScale); } resetLength(); }
VectorInput::VectorInput(const QString &title, bool showLength, bool zeroAllowed, bool useDials, QWidget *parent) : QGroupBox(parent), m_showLength(showLength), m_zeroAllowed(zeroAllowed), m_useDials(useDials) { this->setTitle(title); double stepSize = 0.05f; m_xValueBox = new QDoubleSpinBox(); m_xValueBox->setSingleStep(stepSize); m_xValueBox->setValue(0.0f); m_xValueBox->setMinimum(-99.99f); connect( m_xValueBox, SIGNAL(valueChanged(double)), this, SLOT(xValueChanged(double)) ); m_yValueBox = new QDoubleSpinBox(); m_yValueBox->setSingleStep(stepSize); if( !m_zeroAllowed ) { m_yValueBox->setValue(1.0f); } else { m_yValueBox->setValue(0.0f); } m_yValueBox->setMinimum(-99.99f); connect( m_yValueBox, SIGNAL(valueChanged(double)), this, SLOT(yValueChanged(double)) ); m_zValueBox = new QDoubleSpinBox(); m_zValueBox->setSingleStep(stepSize); m_zValueBox->setValue(0.0f); m_zValueBox->setMinimum(-99.99f); connect( m_zValueBox, SIGNAL(valueChanged(double)), this, SLOT(zValueChanged(double)) ); QGridLayout *gridLayout = new QGridLayout; gridLayout->setHorizontalSpacing(0); gridLayout->setVerticalSpacing(0); gridLayout->addWidget(new QLabel("x:", this), 0, 0, Qt::AlignRight); gridLayout->addWidget(m_xValueBox, 0, 1 ); gridLayout->addWidget(new QLabel("y:", this), 0, 2, Qt::AlignRight); gridLayout->addWidget(m_yValueBox, 0, 3 ); gridLayout->addWidget(new QLabel("z:", this), 0, 4, Qt::AlignRight); gridLayout->addWidget(m_zValueBox, 0, 5 ); if(m_showLength) { m_lengthLabel = new QLabel(this); QString lengthText; lengthText.setNum(this->getLength()); lengthText = "Length: " + lengthText; m_lengthLabel->setText( lengthText ); gridLayout->addWidget(m_lengthLabel, 1, 1, 1, 3); QPushButton* resetLengthButton = new QPushButton("normalize", this); connect( resetLengthButton, SIGNAL(clicked()), this, SLOT(resetLength()) ); gridLayout->addWidget(resetLengthButton, 1, 4, 1, 2); } if( m_useDials ) { int gridRow = m_showLength ? 2 : 1; m_azimuthDial = new QDial(this); m_azimuthDial->setWrapping(true); connect( m_azimuthDial, SIGNAL(valueChanged(int)), this, SLOT(dialValueChanged(int)) ); gridLayout->addWidget( m_azimuthDial, gridRow, 1, 1, 2, Qt::AlignTop ); gridLayout->addWidget( new QLabel("azimuth", this), gridRow+1,1,1,2, Qt::AlignTop | Qt::AlignCenter ); m_longitudialDial = new QDial(this); m_longitudialDial->setWrapping(true); m_longitudialDial->setRange(0, 100); m_longitudialDial->setSingleStep(1); connect( m_longitudialDial, SIGNAL(valueChanged(int)), this, SLOT(dialValueChanged(int)) ); gridLayout->addWidget( m_longitudialDial, gridRow, 4, 1, 2, Qt::AlignTop ); gridLayout->addWidget( new QLabel("longitude", this), gridRow+1,4,1,2, Qt::AlignTop | Qt::AlignCenter ); } this->setLayout(gridLayout); }