WVectorEditor: Make use of Qt 5 signals and slots

This commit is contained in:
Lioncash 2020-07-03 08:04:05 -04:00
parent 54a85f2fba
commit 16ef9988d7
1 changed files with 9 additions and 9 deletions

View File

@ -160,9 +160,9 @@ void WVectorEditor::SetZ(double Z)
void WVectorEditor::SetupUI()
{
// Create and initialize widgets
mpLabelX = new QLabel("X", this);
mpLabelY = new QLabel("Y", this);
mpLabelZ = new QLabel("Z", this);
mpLabelX = new QLabel(tr("X"), this);
mpLabelY = new QLabel(tr("Y"), this);
mpLabelZ = new QLabel(tr("Z"), this);
mpSpinBoxX = new WDraggableSpinBox(this);
mpSpinBoxY = new WDraggableSpinBox(this);
mpSpinBoxZ = new WDraggableSpinBox(this);
@ -175,12 +175,12 @@ void WVectorEditor::SetupUI()
mpSpinBoxX->setContextMenuPolicy(Qt::NoContextMenu);
mpSpinBoxY->setContextMenuPolicy(Qt::NoContextMenu);
mpSpinBoxZ->setContextMenuPolicy(Qt::NoContextMenu);
connect(mpSpinBoxX, SIGNAL(valueChanged(double)), this, SLOT(SetX(double)));
connect(mpSpinBoxY, SIGNAL(valueChanged(double)), this, SLOT(SetY(double)));
connect(mpSpinBoxZ, SIGNAL(valueChanged(double)), this, SLOT(SetZ(double)));
connect(mpSpinBoxX, SIGNAL(editingFinished()), this, SLOT(OnSpinBoxEditingDone()));
connect(mpSpinBoxY, SIGNAL(editingFinished()), this, SLOT(OnSpinBoxEditingDone()));
connect(mpSpinBoxZ, SIGNAL(editingFinished()), this, SLOT(OnSpinBoxEditingDone()));
connect(mpSpinBoxX, qOverload<double>(&WDraggableSpinBox::valueChanged), this, &WVectorEditor::SetX);
connect(mpSpinBoxY, qOverload<double>(&WDraggableSpinBox::valueChanged), this, &WVectorEditor::SetY);
connect(mpSpinBoxZ, qOverload<double>(&WDraggableSpinBox::valueChanged), this, &WVectorEditor::SetZ);
connect(mpSpinBoxX, &WDraggableSpinBox::editingFinished, this, &WVectorEditor::OnSpinBoxEditingDone);
connect(mpSpinBoxY, &WDraggableSpinBox::editingFinished, this, &WVectorEditor::OnSpinBoxEditingDone);
connect(mpSpinBoxZ, &WDraggableSpinBox::editingFinished, this, &WVectorEditor::OnSpinBoxEditingDone);
// Create and initialize spinbox layouts
mpXLayout = new QHBoxLayout();