Files
DbGuiLib/widgets/vector4dwidget.cpp

29 lines
927 B
C++
Raw Permalink Normal View History

2018-09-15 20:22:39 +02:00
#include "vector4dwidget.h"
#include <QHBoxLayout>
#include <QDoubleSpinBox>
Vector4DWidget::Vector4DWidget(QWidget *parent) : QWidget(parent)
{
auto layout = new QHBoxLayout(this);
2019-10-11 20:35:55 +02:00
layout->setContentsMargins({});
2018-09-15 20:22:39 +02:00
layout->addWidget(m_doubleSpinBoxX = new QDoubleSpinBox(this));
layout->addWidget(m_doubleSpinBoxY = new QDoubleSpinBox(this));
layout->addWidget(m_doubleSpinBoxZ = new QDoubleSpinBox(this));
layout->addWidget(m_doubleSpinBoxW = new QDoubleSpinBox(this));
setLayout(layout);
}
QVector4D Vector4DWidget::value() const
{
return QVector4D(m_doubleSpinBoxX->value(), m_doubleSpinBoxY->value(), m_doubleSpinBoxZ->value(), m_doubleSpinBoxW->value());
}
void Vector4DWidget::setValue(const QVector4D &value)
{
m_doubleSpinBoxX->setValue(value.x());
m_doubleSpinBoxY->setValue(value.y());
m_doubleSpinBoxZ->setValue(value.z());
m_doubleSpinBoxW->setValue(value.w());
}